kgiusti commented on a change in pull request #608: DISPATCH-1467: enable
AddressSanitizer build option (ASAN)
URL: https://github.com/apache/qpid-dispatch/pull/608#discussion_r342199172
##########
File path: router/src/main.c
##########
@@ -179,43 +180,40 @@ static void daemon_process(const char *config_path,
const char *python_pkgdir, b
//
- // If config path is not represented by its full path, then
- // save current path before changing to /
+ // If config path is not a fully qualified path, then construct the
+ // fully qualified path to the config file. This needs to be done
+ // since the daemon will set "/" to its working directory.
//
char *config_path_full = NULL;
if (strncmp("/", config_path, 1)) {
- char *cur_path = NULL;
- size_t path_size = 256;
- int getcwd_error = 0;
- cur_path = (char *) calloc(path_size, sizeof(char));
+ size_t path_size = PATH_MAX;
+ char *cur_path = (char *) calloc(path_size, sizeof(char));
errno = 0;
while (getcwd(cur_path, path_size) == NULL) {
free(cur_path);
- if ( errno != ERANGE ) {
- // If unable to get current directory
- getcwd_error = 1;
- break;
+ if (errno != ERANGE) {
+ // Hard failure - can't recover from this
Review comment:
It is related - the address sanitizer threw a fit on that section of the
code - detected a possible buffer overflow. That change is the fix.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]