]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: server: Use memcpy() instead of strncpy().
authorOlivier Houchard <ohouchard@haproxy.com>
Tue, 16 Oct 2018 16:35:01 +0000 (18:35 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 16 Oct 2018 17:22:20 +0000 (19:22 +0200)
Use memcpy instead of strncpy, strncpy buys us nothing, and gcc is being
annoying.

src/server.c

index c817c39169ed619243280f5a54c5774600619443..9a0392084fbb18eee301ae7c2c8797dfc6877b4e 100644 (file)
@@ -3170,7 +3170,7 @@ void apply_server_state(void)
                                globalfilepathlen = 0;
                                goto globalfileerror;
                        }
-                       strncpy(globalfilepath, global.server_state_base, len);
+                       memcpy(globalfilepath, global.server_state_base, len);
                        globalfilepath[globalfilepathlen] = 0;
 
                        /* append a slash if needed */
@@ -3239,7 +3239,7 @@ void apply_server_state(void)
                                                localfilepathlen = 0;
                                                goto localfileerror;
                                        }
-                                       strncpy(localfilepath, global.server_state_base, len);
+                                       memcpy(localfilepath, global.server_state_base, len);
                                        localfilepath[localfilepathlen] = 0;
 
                                        /* append a slash if needed */