]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
rdmacm-mux: fix strcpy string warning
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Fri, 12 Jul 2019 16:51:54 +0000 (20:51 +0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 15 Jul 2019 09:20:42 +0000 (11:20 +0200)
../contrib/rdmacm-mux/main.c: In function ‘parse_args’:
../contrib/rdmacm-mux/main.c:118:13: error: ‘strncpy’ specified bound 3835 equals destination size [-Werror=stringop-truncation]
  118 |             strncpy(unix_socket_path, optarg, SOCKET_PATH_MAX);

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190712165154.11504-1-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
contrib/rdmacm-mux/main.c

index 30c7052651b46bf9502d715dd504341177c50339..de53048f061914462880bd2e4da9b49a29e0f9e8 100644 (file)
@@ -115,7 +115,7 @@ static void parse_args(int argc, char *argv[])
 
         case 's':
             /* This is temporary, final name will build below */
-            strncpy(unix_socket_path, optarg, SOCKET_PATH_MAX);
+            strncpy(unix_socket_path, optarg, SOCKET_PATH_MAX - 1);
             break;
 
         case 'p':