Fix a crash due to buggy user input.
Improve error message. Reported in https://gitlab.com/kicad/code/kicad/-/issues/19439#note_2277932762
This commit is contained in:
parent
0f5852afdb
commit
caa0a7f4a8
|
|
@ -117,6 +117,12 @@ struct pnode* ft_getpnames_quotes(wordlist* wl, bool check)
|
||||||
tmpstr += 2;
|
tmpstr += 2;
|
||||||
/* get the complete zzz of v(zzz) */
|
/* get the complete zzz of v(zzz) */
|
||||||
char* tpartoken = tmpstr2 = gettok_char(&tmpstr, ')', FALSE, FALSE);
|
char* tpartoken = tmpstr2 = gettok_char(&tmpstr, ')', FALSE, FALSE);
|
||||||
|
/* Bail out in case of missing closing paren */
|
||||||
|
if (!tpartoken) {
|
||||||
|
fprintf(stderr, "Error: Missing ')' in token %s\n", sz);
|
||||||
|
fprintf(stderr, " Cannot parse the token!\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
/* check if this is v(zzz) or v(xx,yy) */
|
/* check if this is v(zzz) or v(xx,yy) */
|
||||||
char* partoken1 = gettok_char(&tpartoken, ',', FALSE, FALSE);
|
char* partoken1 = gettok_char(&tpartoken, ',', FALSE, FALSE);
|
||||||
sadd(&ds1, "v(");
|
sadd(&ds1, "v(");
|
||||||
|
|
|
||||||
|
|
@ -469,6 +469,7 @@ com_write(wordlist *wl)
|
||||||
names = ft_getpnames_quotes(&all, TRUE);
|
names = ft_getpnames_quotes(&all, TRUE);
|
||||||
|
|
||||||
if (names == NULL) {
|
if (names == NULL) {
|
||||||
|
fprintf(stderr, "Error during 'write': no writable vector found.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue