Buffer overflow by one byte

master
Lekensteyn 13 years ago
parent 804773eb22
commit 647e3dddea

@ -74,9 +74,8 @@ int dis_before_suspend_disabled;
static char *buffer_to_string(const char *buffer, size_t n, char *target) { static char *buffer_to_string(const char *buffer, size_t n, char *target) {
int i; int i;
for (i=0; i<n; i++) { for (i=0; i<n; i++) {
sprintf(target + i * 5, "%02X,", buffer[i]); snprintf(target + i * 5, 5 * (n - i), "%02X,", buffer[i]);
} }
target[n * 5] = '\0';
return target; return target;
} }

Loading…
Cancel
Save