From d76862055edfbb84189bb82bfe7ed3d936eb4e30 Mon Sep 17 00:00:00 2001 From: rlar Date: Sun, 19 Sep 2010 14:09:12 +0000 Subject: [PATCH] cp_unqoute(), avoid segfault when applied to a single quote "\"" --- ChangeLog | 13 ++++++++++++- src/frontend/quote.c | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index efaaeb70b..b64c944fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,18 @@ +2010-09-19 Robert Larice + * src/frontend/quote.c : + cp_unqoute(), avoid segfault when applied to a single quote "\"" + testcase: + .control + echo "--" + .endc + FIXME, still not completely done, + inp_stripcomments_line() + will fail on comments inside of strings + 2010-09-19 Holger Vogt * src/spinit.in, configure.ac: allow lib64 in spinit (bug no. 3054424) if libdir contains lib64 - * compile_min.sh: new script for compiling MINGW 32 and 64 bit + * compile_min.sh: new script for compiling MINGW 32 and 64 bit 2010-09-18 Holger Vogt * src/XSPICE/icm/makedefs.in: external LDFLAGS enabled for MINGW diff --git a/src/frontend/quote.c b/src/frontend/quote.c index 3747b28e4..b81a501a9 100644 --- a/src/frontend/quote.c +++ b/src/frontend/quote.c @@ -81,7 +81,7 @@ cp_unquote(char *string) l = strlen(string); s = (char*) MALLOC(l+1); - if (*string == '"' && string[l-1] == '"') { + if (l>=2 && *string == '"' && string[l-1] == '"') { strncpy(s,string+1,l-2); s[l-2] = '\0'; } else