sym_vs_sch_pins(): check for not NULL pin_dir to avoid crash, as per Tim Edwards findings

This commit is contained in:
stefan schippers 2024-07-03 08:39:56 +02:00
parent 978739b1e5
commit e8e4196da2
1 changed files with 12 additions and 1 deletions

View File

@ -1749,8 +1749,19 @@ int sym_vs_sch_pins(int all)
my_strdup(_ALLOC_ID_, &pin_name,
expandlabel(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "name", 0), &mult));
my_strdup(_ALLOC_ID_, &pin_dir, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "dir", 0));
if( pin_name && !strcmp(pin_name, lab)) {
if(!(
if(!pin_dir) {
char str[2048];
my_snprintf(str, S(str), "Error: Symbol %s: No direction given for pin %s",
xctx->sym[i].name, lab);
statusmsg(str,2);
my_snprintf(str, S(str), " %s <--> ???", type);
statusmsg(str,2);
err |= 1;
}
else if(!(
( !strcmp(type, "ipin") && !strcmp(pin_dir, "in") ) ||
( !strcmp(type, "opin") && !strcmp(pin_dir, "out") ) ||
( !strcmp(type, "iopin") && !strcmp(pin_dir, "inout") )