Permalink
Browse files

use memcpy in NUMCOPY macro rather than snprintf

snprintf is foolish here, and it also generates stupid valgrind warnings.
  • Loading branch information...
1 parent 0c86d10 commit d93adfd36a0a80a8dbf23b419b6401a3f7e4d73e @falconindy committed Dec 27, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 cower.c
View
@@ -1011,7 +1011,8 @@ int json_string(void *ctx, const unsigned char *data, size_t size) /* {{{ */
dest[n] = '\0';
#define NUMCOPY(dest, src, n) \
- snprintf(buffer, n + 1, "%s", src); \
+ memcpy(buffer, src, n); \
+ buffer[n] = '\0'; \
dest = strtol(buffer, NULL, 10);
if(KEY_IS(AUR_ID)) {

0 comments on commit d93adfd

Please sign in to comment.