Advertisement
Guest User

Untitled

a guest
May 4th, 2015
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. diff -urN tokyotyrant-1.1.41.orig/ttutil.c tokyotyrant-1.1.41/ttutil.c
  2. --- tokyotyrant-1.1.41.orig/ttutil.c 2010-08-04 23:24:33.000000000 -0700
  3. +++ tokyotyrant-1.1.41/ttutil.c 2015-03-19 01:04:27.000000000 -0700
  4. @@ -24,7 +24,6 @@
  5. *************************************************************************************************/
  6.  
  7.  
  8. -#define SOCKPATHBUFSIZ 108 // size of a socket path buffer
  9. #define SOCKRCVTIMEO 0.25 // timeout of the recv call of socket
  10. #define SOCKSNDTIMEO 0.25 // timeout of the send call of socket
  11. #define SOCKCNCTTIMEO 5.0 // timeout of the connect call of socket
  12. @@ -127,7 +126,7 @@
  13. struct sockaddr_un saun;
  14. memset(&saun, 0, sizeof(saun));
  15. saun.sun_family = AF_UNIX;
  16. - snprintf(saun.sun_path, SOCKPATHBUFSIZ, "%s", path);
  17. + strncpy(saun.sun_path, path, sizeof(saun.sun_path)-1);
  18. int fd = socket(PF_UNIX, SOCK_STREAM, 0);
  19. if(fd == -1) return -1;
  20. int optint = 1;
  21. @@ -187,7 +186,7 @@
  22. struct sockaddr_un saun;
  23. memset(&saun, 0, sizeof(saun));
  24. saun.sun_family = AF_UNIX;
  25. - snprintf(saun.sun_path, SOCKPATHBUFSIZ, "%s", path);
  26. + strncpy(saun.sun_path, path, sizeof(saun.sun_path)-1);
  27. int fd = socket(PF_UNIX, SOCK_STREAM, 0);
  28. if(fd == -1) return -1;
  29. if(bind(fd, (struct sockaddr *)&saun, sizeof(saun)) != 0 ||
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement