summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-19 19:39:35 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-19 19:39:35 -0300
commit5eab5cf2cc5c7e19b05dc2c0c88fa5c975e5230c (patch)
tree4d5a750b9e02e15b2fe987a381d4ff238d4a59e5
parent9b05360c849b56f54f194ab355c81964efa9ccfe (diff)
downloadeeshow-5eab5cf2cc5c7e19b05dc2c0c88fa5c975e5230c.tar.gz
eeshow-5eab5cf2cc5c7e19b05dc2c0c88fa5c975e5230c.tar.bz2
eeshow-5eab5cf2cc5c7e19b05dc2c0c88fa5c975e5230c.zip
eeshow/kicad/sch-parse.c (parse_field): verify that we actually reached the %n
-rw-r--r--kicad/sch-parse.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kicad/sch-parse.c b/kicad/sch-parse.c
index 3b7878f..3cdebb4 100644
--- a/kicad/sch-parse.c
+++ b/kicad/sch-parse.c
@@ -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])