From: Richard W.M. Jones Date: Thu, 23 Apr 2009 13:47:06 +0000 (+0100) Subject: Fix buffer overrun in guestfish command-line parsing. X-Git-Tag: 1.0.11~7 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=b18961055531f0107ed4f62c0d2f28e4ac1270e0;p=libguestfs.git Fix buffer overrun in guestfish command-line parsing. --- diff --git a/fish/fish.c b/fish/fish.c index 41776ca..1255a2d 100644 --- a/fish/fish.c +++ b/fish/fish.c @@ -366,7 +366,7 @@ script (int prompt) goto next_command; } p[len] = '\0'; - pend = &p[len+2]; + pend = p[len+1] ? &p[len+2] : &p[len+1]; } else if (*p == '\'') { p++; len = strcspn (p, "'"); @@ -381,7 +381,7 @@ script (int prompt) goto next_command; } p[len] = '\0'; - pend = &p[len+2]; + pend = p[len+1] ? &p[len+2] : &p[len+1]; /* } else if (*p == '[') { int c = 1;