Revision: 14660 Author: adrian.chadd Date: Sat May 15 03:08:08 2010 Log: Fix an incorrectly terminated buffer in strtol_n().
http://code.google.com/p/lusca-cache/source/detail?r=14660 Modified: /branches/LUSCA_HEAD/lib/util.c ======================================= --- /branches/LUSCA_HEAD/lib/util.c Tue May 4 21:29:57 2010 +++ /branches/LUSCA_HEAD/lib/util.c Sat May 15 03:08:08 2010 @@ -772,10 +772,11 @@ char buf[64]; long r; char *np = NULL; + int l = MIN(nlen, sizeof(buf) - 1); /* take a copy of the string, NUL terminate it just in case */ - memcpy(buf, nptr, MIN(nlen, sizeof(buf) - 1)); - buf[sizeof(buf) - 1] = '\0'; + memcpy(buf, nptr, l); + buf[l] = '\0'; /* Now do the parsing */ r = strtol(buf, &np, base); -- You received this message because you are subscribed to the Google Groups "lusca-commit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/lusca-commit?hl=en.
