mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
Fix off-by-one error when allocating memory in test_util_split_lines()
Triggered "failed OVER picket-fence magic-number check (err 27)" when memory debugging using dmalloc is enabled (at 'low' or higher).
This commit is contained in:
parent
38ee959ea9
commit
76fde28475
@ -1637,7 +1637,8 @@ test_util_split_lines(void *ptr)
|
||||
|
||||
for (i=0; tests[i].orig_line; i++) {
|
||||
sl = smartlist_create();
|
||||
orig_line = tor_malloc(tests[i].orig_length);
|
||||
/* Allocate space for string and trailing NULL */
|
||||
orig_line = tor_malloc(tests[i].orig_length + 1);
|
||||
memcpy(orig_line, tests[i].orig_line, tests[i].orig_length + 1);
|
||||
tor_split_lines(sl, orig_line, tests[i].orig_length);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user