diff options
author | Volker Lendecke <vl@samba.org> | 2009-11-30 21:48:33 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2009-12-08 09:15:16 +0100 |
commit | 11bd972d60964fc8442c15ed2530ff61cb443ccc (patch) | |
tree | 208cc77c5dfc96c5cbba1818bf60ab3ab2101600 /source4 | |
parent | d0cac2dc28fe344eca3f86a681ef5dbd290370ea (diff) | |
download | samba-11bd972d60964fc8442c15ed2530ff61cb443ccc.tar.gz |
Fix bug 6546: Avoid accessing buf[-1] if NUL byte comes from fgets
(cherry picked from commit c0282f8f7d40b893610fdc235cb130f1fedbeb13)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/torture/nbench/nbench.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source4/torture/nbench/nbench.c b/source4/torture/nbench/nbench.c index 5a4037f906d..05c889d1b7d 100644 --- a/source4/torture/nbench/nbench.c +++ b/source4/torture/nbench/nbench.c @@ -95,7 +95,9 @@ again: nbench_line_count++; - line[strlen(line)-1] = 0; + if ((strlen(line) > 0) && line[strlen(line)-1] == '\n') { + line[strlen(line)-1] = 0; + } all_string_sub(line,"client1", cname, sizeof(line)); |