Skip to content

Commit

Permalink
sprintf -> snprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
ryancdotorg committed Oct 29, 2015
1 parent bd24610 commit 4f9edc7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hex.c
Expand Up @@ -11,7 +11,7 @@ hex(unsigned char *buf, size_t buf_sz,
int i, j; int i, j;
--hexed_sz; --hexed_sz;
for (i = j = 0; i < buf_sz && j < hexed_sz; ++i, j += 2) { 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 hexed[j] = 0; // null terminate
return hexed; return hexed;
Expand Down

0 comments on commit 4f9edc7

Please sign in to comment.