summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-04-23 14:47:06 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-04-23 14:47:06 +0100
commitb18961055531f0107ed4f62c0d2f28e4ac1270e0 (patch)
tree995c1a4feb08105dfe7173efb19698ab0c9c096f
parent8f9f02d483b87c787d089cf9329f5f1b81d3a77e (diff)
downloadlibguestfs-b18961055531f0107ed4f62c0d2f28e4ac1270e0.tar.gz
libguestfs-b18961055531f0107ed4f62c0d2f28e4ac1270e0.tar.xz
libguestfs-b18961055531f0107ed4f62c0d2f28e4ac1270e0.zip
Fix buffer overrun in guestfish command-line parsing.
-rw-r--r--fish/fish.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fish/fish.c b/fish/fish.c
index 41776ca7..1255a2d0 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;