From 423de1c03de14f2d27b08736a497b9863cae9079 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Mon, 10 Feb 2014 01:59:37 +0000 Subject: [PATCH] * environ.cc (strbrk): Properly deal with environment variable sans quote. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/environ.cc | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 3e8dacdd4..76da1ec23 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2014-02-09 Christopher Faylor + + * environ.cc (strbrk): Properly deal with environment variable sans + quote. + 2014-02-09 Christopher Faylor * environ.cc (strbrk): New function. diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc index 5ac155e37..a53b5f085 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 {