summaryrefslogtreecommitdiff
path: root/scripts/basic
diff options
context:
space:
mode:
authorMike Frysinger2006-12-30 19:21:48 +0000
committerMike Frysinger2006-12-30 19:21:48 +0000
commitc255f8b492ea8309b7f554aa2814545efa67fa58 (patch)
treebcd94ce62f41bf371e0b363b60574fe13e56b85e /scripts/basic
parent6a5dc5d75a1368464fc7e085aa1f1d4c453d27cd (diff)
downloadbusybox-c255f8b492ea8309b7f554aa2814545efa67fa58.zip
busybox-c255f8b492ea8309b7f554aa2814545efa67fa58.tar.gz
prevent accessing memory that we dont own
Diffstat (limited to 'scripts/basic')
-rw-r--r--scripts/basic/fixdep.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index df3446e..2fa78ee 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -231,10 +231,10 @@ void parse_config_file(char *map, size_t len)
int off;
for (; p < end; p++) {
- if (!memcmp(p, "CONFIG_", 7)) goto conf7;
- if (!memcmp(p, "ENABLE_", 7)) goto conf7;
- if (!memcmp(p, "USE_", 4)) goto conf4;
- if (!memcmp(p, "SKIP_", 5)) goto conf5;
+ if (p<end-7 && !memcmp(p, "CONFIG_", 7)) goto conf7;
+ if (p<end-7 && !memcmp(p, "ENABLE_", 7)) goto conf7;
+ if (p<end-4 && !memcmp(p, "USE_", 4)) goto conf4;
+ if (p<end-5 && !memcmp(p, "SKIP_", 5)) goto conf5;
continue;
conf4: off = 4; goto conf;
conf5: off = 5; goto conf;
@@ -303,7 +303,7 @@ void parse_dep_file(void *map, size_t len)
char *p;
char s[PATH_MAX];
- p = strchr(m, ':');
+ p = memchr(m, ':', len);
if (!p) {
fprintf(stderr, "fixdep: parse error\n");
exit(1);