aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/environ.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2014-02-10 01:59:37 +0000
committerChristopher Faylor <me@cgf.cx>2014-02-10 01:59:37 +0000
commit423de1c03de14f2d27b08736a497b9863cae9079 (patch)
tree71d8cef08a7fb22412f4a5cae44c18e43ff0ad00 /winsup/cygwin/environ.cc
parent16be32590d0e9cd77e0f6cfee962395e999300a2 (diff)
downloadnewlib-423de1c03de14f2d27b08736a497b9863cae9079.zip
newlib-423de1c03de14f2d27b08736a497b9863cae9079.tar.gz
newlib-423de1c03de14f2d27b08736a497b9863cae9079.tar.bz2
* environ.cc (strbrk): Properly deal with environment variable sans quote.
Diffstat (limited to 'winsup/cygwin/environ.cc')
-rw-r--r--winsup/cygwin/environ.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 5ac155e..a53b5f0 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -148,10 +148,10 @@ strbrk(char *&buf)
char *tok = buf;
char *sep = buf + strcspn(buf, " \t");
char *quotestart = strchr(buf, '"');
- if (quotestart > sep)
+ if (!quotestart || quotestart > sep)
{
+ buf = sep + !!*sep; /* Don't point beyond EOS */
quotestart = NULL;
- buf = sep + 1;
}
else
{