From: Philip Homburg Date: Wed, 8 Jun 2005 11:05:27 +0000 (+0000) Subject: Hack for buffer overflow, should be fixed properly. X-Git-Tag: v3.1.0~762 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/doc/syslog.3.html?a=commitdiff_plain;h=d9b609c70f95705401aae1576fe66df554ea96f6;p=minix.git Hack for buffer overflow, should be fixed properly. --- diff --git a/commands/ash/expand.c b/commands/ash/expand.c index 8fbc82650..1b6d2a816 100755 --- a/commands/ash/expand.c +++ b/commands/ash/expand.c @@ -672,7 +672,10 @@ expandmeta(str) savelastp = exparg.lastp; INTOFF; if (expdir == NULL) - expdir = ckmalloc(1024); /* I hope this is big enough */ + { + int i = strlen(str->text); + expdir = ckmalloc(i < 2048 ? 2048 : i); /* XXX */ + } expmeta(expdir, str->text); ckfree(expdir); expdir = NULL;