qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gmur...@apache.org
Subject [qpid-dispatch] branch master updated: DISPATCH-1262: fix GCC 8.2 format-truncation error in router/src/main.c
Date Mon, 04 Feb 2019 14:34:57 GMT
This is an automated email from the ASF dual-hosted git repository.

gmurthy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/master by this push:
     new ca7d346  DISPATCH-1262: fix GCC 8.2 format-truncation error in router/src/main.c
ca7d346 is described below

commit ca7d3461462f1ca749046a544e6bc0294164a1b1
Author: Jiri Danek <jdanek@redhat.com>
AuthorDate: Mon Feb 4 12:37:29 2019 +0100

    DISPATCH-1262: fix GCC 8.2 format-truncation error in router/src/main.c
    
    Gcc warns because `getcwd` on Linux may allocate and return new buffer,
    so don't ignore the returned value. And cur_path may in theory be null
    going in if previous `calloc` failed.
    
    It is unlikely we would end up with cur_path = NULL as parameter to `%s`
    in a formatting string later below, but it is possible, given very
    careful timing and sufficiently malicious user, I think.
    
    Change is made to silence GCC warning, so that ``-fsanitize=undefined` compiles.
    
    This closes #448.
---
 router/src/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/router/src/main.c b/router/src/main.c
index 3b7eecd..db0b279 100644
--- a/router/src/main.c
+++ b/router/src/main.c
@@ -189,7 +189,7 @@ static void daemon_process(const char *config_path, const char *python_pkgdir,
b
                 int getcwd_error = 0;
                 cur_path = (char *) calloc(path_size, sizeof(char));
 
-                while ( getcwd(cur_path, path_size) == NULL ) {
+                while ((cur_path = getcwd(cur_path, path_size)) == NULL) {
                     free(cur_path);
                     if ( errno != ERANGE ) {
                         // If unable to get current directory


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message