summaryrefslogtreecommitdiffstats
path: root/text-utils/more.c
diff options
context:
space:
mode:
authorKarel Zak2013-08-01 12:58:22 +0200
committerKarel Zak2013-08-01 12:58:22 +0200
commit1ef2db5a5672e09fa1337099b7d9d6ab61c19bdc (patch)
tree3f2152d74b8387c20bd88a412923c68f6020ee4d /text-utils/more.c
parentsetsid: add an option to wait child return value (diff)
downloadkernel-qcow2-util-linux-1ef2db5a5672e09fa1337099b7d9d6ab61c19bdc.tar.gz
kernel-qcow2-util-linux-1ef2db5a5672e09fa1337099b7d9d6ab61c19bdc.tar.xz
kernel-qcow2-util-linux-1ef2db5a5672e09fa1337099b7d9d6ab61c19bdc.zip
more: fix buffer overflow
The bug has been probably introduced by commit 1ac300932deab8dea2c43050921bbbdb36d62ff1. Reported-by: "Dr. David Alan Gilbert" <dave@treblig.org> References: https://bugzilla.novell.com/show_bug.cgi?id=829720 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'text-utils/more.c')
-rw-r--r--text-utils/more.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/text-utils/more.c b/text-utils/more.c
index 3bbeede5d..33771183c 100644
--- a/text-utils/more.c
+++ b/text-utils/more.c
@@ -835,7 +835,8 @@ void prepare_line_buffer(void)
if (nsz < LINSIZ)
nsz = LINSIZ;
- nline = xrealloc(Line, nsz);
+ /* alloc nsz and extra space for \n\0 */
+ nline = xrealloc(Line, nsz + 2);
Line = nline;
LineLen = nsz;
}