You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.1 KiB

  1. commit 541e3b40b394fb6bde563ff8ce4c882dafca4eb1
  2. Author: Olivier Houchard <ohouchard@haproxy.com>
  3. Date: Tue Oct 16 18:35:01 2018 +0200
  4. MINOR: server: Use memcpy() instead of strncpy().
  5. Use memcpy instead of strncpy, strncpy buys us nothing, and gcc is being
  6. annoying.
  7. (cherry picked from commit 17f8b90736d811ac9a04af198a3aee34e9935cec)
  8. Signed-off-by: Willy Tarreau <w@1wt.eu>
  9. diff --git a/src/server.c b/src/server.c
  10. index 4941bd03..208f21da 100644
  11. --- a/src/server.c
  12. +++ b/src/server.c
  13. @@ -3078,7 +3078,7 @@ void apply_server_state(void)
  14. globalfilepathlen = 0;
  15. goto globalfileerror;
  16. }
  17. - strncpy(globalfilepath, global.server_state_base, len);
  18. + memcpy(globalfilepath, global.server_state_base, len);
  19. globalfilepath[globalfilepathlen] = 0;
  20. /* append a slash if needed */
  21. @@ -3147,7 +3147,7 @@ void apply_server_state(void)
  22. localfilepathlen = 0;
  23. goto localfileerror;
  24. }
  25. - strncpy(localfilepath, global.server_state_base, len);
  26. + memcpy(localfilepath, global.server_state_base, len);
  27. localfilepath[localfilepathlen] = 0;
  28. /* append a slash if needed */