Permalink
Browse files

sprintf -> snprintf

  • Loading branch information...
ryancdotorg committed Oct 29, 2015
1 parent bd24610 commit 4f9edc7197c35c28200bd517a5ca44b30a697079
Showing with 1 addition and 1 deletion.
  1. +1 −1 hex.c
View
2 hex.c
@@ -11,7 +11,7 @@ hex(unsigned char *buf, size_t buf_sz,
int i, j;
--hexed_sz;
for (i = j = 0; i < buf_sz && j < hexed_sz; ++i, j += 2) {
sprintf(hexed+j, "%02x", buf[i]);
snprintf(hexed+j, 3, "%02x", buf[i]);
}
hexed[j] = 0; // null terminate
return hexed;

0 comments on commit 4f9edc7

Please sign in to comment.