1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-24 00:45:52 +00:00
freebsd-ports/cad/spice/files/patch-src_lib_misc_string.c
Hiroki Sato cb28a2affc - Fix SIGSEGV when there are spaces after a comma like ".PRINT TRAN v(2, 1)".
- Style clean-ups.

PR:		ports/157313
Spotted by:	Makoto Kishimoto
2013-04-30 20:30:22 +00:00

20 lines
507 B
C

--- src/lib/misc/string.c.orig 2013-05-01 03:50:59.000000000 +0900
+++ src/lib/misc/string.c 2013-05-01 03:58:30.000000000 +0900
@@ -148,13 +148,15 @@
(*s)++;
if (!**s)
return (NULL);
- while ((c = **s) && !isspace(c)) {
+ while ((c = **s)) {
if (c == '('/*)*/)
paren += 1;
else if (c == /*(*/')')
paren -= 1;
else if (c == ',' && paren < 1)
break;
+ else if (isspace(c) && paren < 1)
+ break;
buf[i++] = *(*s)++;
}
buf[i] = '\0';