mirror of
https://git.code.sf.net/p/ngspice/ngspice
synced 2026-09-08 22:39:10 +02:00
cp_unqoute(), avoid segfault when applied to a single quote "\""
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user