mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-22 20:14:04 +02:00
eeshow/kicad/sch-parse.c (parse_field): verify that we actually reached the %n
This commit is contained in:
parent
6be9e7ac0c
commit
84de6b9ce6
@ -101,7 +101,7 @@ static bool parse_field(struct sch_ctx *ctx, const char *line)
|
|||||||
struct text *txt;
|
struct text *txt;
|
||||||
char *s;
|
char *s;
|
||||||
const char *p;
|
const char *p;
|
||||||
int pos, len;
|
int pos = 0, len;
|
||||||
|
|
||||||
field = alloc_type(struct comp_field);
|
field = alloc_type(struct comp_field);
|
||||||
txt = &field->txt;
|
txt = &field->txt;
|
||||||
@ -114,7 +114,7 @@ static bool parse_field(struct sch_ctx *ctx, const char *line)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sscanf(line, "F %d \"%n", &n, &pos) != 1)
|
if (sscanf(line, "F %d \"%n", &n, &pos) != 1 || !pos)
|
||||||
return 0;
|
return 0;
|
||||||
for (p = line + pos; *p && *p != '"'; p++)
|
for (p = line + pos; *p && *p != '"'; p++)
|
||||||
if (*p == '\\' && p[1])
|
if (*p == '\\' && p[1])
|
||||||
|
Loading…
Reference in New Issue
Block a user