aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-07-28 06:37:04 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-07-28 06:37:04 +0000
commit2b384b7fb40254c7f85e1e1969dd1b1005c62c84 (patch)
tree6ae2f7e9fb53942c022159ef233c3cce69650646 /libbb
parent7cf72d94ebbff177bd9b3fe3873981c0551f03e2 (diff)
downloadbusybox-w32-2b384b7fb40254c7f85e1e1969dd1b1005c62c84.tar.gz
busybox-w32-2b384b7fb40254c7f85e1e1969dd1b1005c62c84.tar.bz2
busybox-w32-2b384b7fb40254c7f85e1e1969dd1b1005c62c84.zip
James Petterson writes:
I've found a possible bug in libbb/interface.c, in function if_readlist_proc(). This function calls get_name(), and passes as an argument 'name', a buffer of 16 bytes (IFNAMSIZ). The function get_name(), however, may use more than 16 bytes, when it is searching for aliases. Even if you don't have an alias interface, you can run into trouble if the interface has received more than 99999999 bytes, in which case the space between the interface name and the rx stats disappears, as in the /proc/net/dev example below: wan0.200:264573315 462080 ... In this case get_name() correctly identifies the interface name as "wan0.200", but to do that it uses 18 bytes of the 'name' buffer, which could lead to an unpredictable error. A simple solution would be to increase the size of the buffer: git-svn-id: svn://busybox.net/trunk/busybox@7117 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'libbb')
-rw-r--r--libbb/interface.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libbb/interface.c b/libbb/interface.c
index 46c3ba96c..47358fe0d 100644
--- a/libbb/interface.c
+++ b/libbb/interface.c
@@ -15,7 +15,7 @@
15 * that either displays or sets the characteristics of 15 * that either displays or sets the characteristics of
16 * one or more of the system's networking interfaces. 16 * one or more of the system's networking interfaces.
17 * 17 *
18 * Version: $Id: interface.c,v 1.17 2003/07/22 08:56:46 andersen Exp $ 18 * Version: $Id: interface.c,v 1.18 2003/07/28 06:35:32 andersen Exp $
19 * 19 *
20 * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> 20 * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
21 * and others. Copyright 1993 MicroWalt Corporation 21 * and others. Copyright 1993 MicroWalt Corporation
@@ -1134,7 +1134,7 @@ static int if_readlist_proc(char *target)
1134 1134
1135 err = 0; 1135 err = 0;
1136 while (fgets(buf, sizeof buf, fh)) { 1136 while (fgets(buf, sizeof buf, fh)) {
1137 char *s, name[IFNAMSIZ]; 1137 char *s, name[128];
1138 1138
1139 s = get_name(name, buf); 1139 s = get_name(name, buf);
1140 ife = add_interface(name); 1140 ife = add_interface(name);