summaryrefslogtreecommitdiff
path: root/source4/torture/nbench
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-11-30 21:48:33 +0100
committerVolker Lendecke <vl@samba.org>2009-11-30 21:48:59 +0100
commit6aef5e591f3fa1ceeedb22273d2fe04298b6e3fb (patch)
tree71eed40f3bdddd8085f57ef5ae581ee03bc0c30e /source4/torture/nbench
parent3b7f8a759f57f32a8c1bc2db85236e88f616ffd9 (diff)
downloadsamba-6aef5e591f3fa1ceeedb22273d2fe04298b6e3fb.tar.gz
samba-6aef5e591f3fa1ceeedb22273d2fe04298b6e3fb.tar.bz2
samba-6aef5e591f3fa1ceeedb22273d2fe04298b6e3fb.zip
Fix bug 6546: Avoid accessing buf[-1] if NUL byte comes from fgets
Diffstat (limited to 'source4/torture/nbench')
-rw-r--r--source4/torture/nbench/nbench.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source4/torture/nbench/nbench.c b/source4/torture/nbench/nbench.c
index 5a4037f906..05c889d1b7 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));