1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-12-23 05:29:52 +02:00

eeshow/kicad/sch-parse.c (parse_field): verify that we actually reached the %n

This commit is contained in:
Werner Almesberger 2016-08-19 19:39:35 -03:00
parent 6be9e7ac0c
commit 84de6b9ce6

View File

@ -101,7 +101,7 @@ static bool parse_field(struct sch_ctx *ctx, const char *line)
struct text *txt;
char *s;
const char *p;
int pos, len;
int pos = 0, len;
field = alloc_type(struct comp_field);
txt = &field->txt;
@ -114,7 +114,7 @@ static bool parse_field(struct sch_ctx *ctx, const char *line)
return 1;
}
if (sscanf(line, "F %d \"%n", &n, &pos) != 1)
if (sscanf(line, "F %d \"%n", &n, &pos) != 1 || !pos)
return 0;
for (p = line + pos; *p && *p != '"'; p++)
if (*p == '\\' && p[1])