diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-10-26 10:19:19 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-10-26 10:19:19 +0000 |
commit | fda2b7ff47c6cd35f2fdf673125a834d0ffe0593 (patch) | |
tree | 93ee33748607930bd4b52629e390bbed3410c64f /editors/vi.c | |
parent | 12f834ccfcb2a290f07092db19edeff8d9c7ab38 (diff) | |
download | busybox-w32-fda2b7ff47c6cd35f2fdf673125a834d0ffe0593.tar.gz busybox-w32-fda2b7ff47c6cd35f2fdf673125a834d0ffe0593.tar.bz2 busybox-w32-fda2b7ff47c6cd35f2fdf673125a834d0ffe0593.zip |
A patch from Jouni Malinen to avoid some buffer overflows in vi,
closing bug #1270
Diffstat (limited to 'editors/vi.c')
-rw-r--r-- | editors/vi.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/editors/vi.c b/editors/vi.c index ce6c3d8cc..1275d133b 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -19,7 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | static const char vi_Version[] = | 21 | static const char vi_Version[] = |
22 | "$Id: vi.c,v 1.23 2002/08/21 13:02:24 aaronl Exp $"; | 22 | "$Id: vi.c,v 1.24 2002/10/26 10:19:19 andersen Exp $"; |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * To compile for standalone use: | 25 | * To compile for standalone use: |
@@ -2566,8 +2566,14 @@ static Byte get_one_char() | |||
2566 | // adding STDIN chars to q | 2566 | // adding STDIN chars to q |
2567 | c = readit(); // get the users input | 2567 | c = readit(); // get the users input |
2568 | if (last_modifying_cmd != 0) { | 2568 | if (last_modifying_cmd != 0) { |
2569 | // add new char to q | 2569 | int len = strlen((char *) last_modifying_cmd); |
2570 | last_modifying_cmd[strlen((char *) last_modifying_cmd)] = c; | 2570 | if (len + 1 >= BUFSIZ) { |
2571 | psbs("last_modifying_cmd overrun"); | ||
2572 | } else { | ||
2573 | // add new char to q | ||
2574 | last_modifying_cmd[len] = c; | ||
2575 | } | ||
2576 | |||
2571 | } | 2577 | } |
2572 | } | 2578 | } |
2573 | #else /* CONFIG_FEATURE_VI_DOT_CMD */ | 2579 | #else /* CONFIG_FEATURE_VI_DOT_CMD */ |