proc: fix too long string allocation

This commit is contained in:
Thomas Schoebel-Theuer 2014-03-21 09:41:55 +01:00 committed by Thomas Schoebel-Theuer
parent 17ef391953
commit 43e4312c1a
1 changed files with 3 additions and 2 deletions

View File

@ -127,13 +127,14 @@ int lamport_sysctl_handler(
if (write) { if (write) {
return -EINVAL; return -EINVAL;
} else { } else {
char *tmp = brick_string_alloc(len); int my_len = 128;
char *tmp = brick_string_alloc(my_len);
struct timespec know = CURRENT_TIME; struct timespec know = CURRENT_TIME;
struct timespec lnow; struct timespec lnow;
get_lamport(&lnow); get_lamport(&lnow);
res = scnprintf(tmp, len, res = scnprintf(tmp, my_len,
"CURRENT_TIME=%ld.%09ld\n" "CURRENT_TIME=%ld.%09ld\n"
"lamport_now=%ld.%09ld\n", "lamport_now=%ld.%09ld\n",
know.tv_sec, know.tv_nsec, know.tv_sec, know.tv_nsec,