Skip to content

Commit

Permalink
Skip parts with all 0xff/0x00 signature
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanrueger committed Jul 14, 2024
1 parent 811d01e commit 43c915a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/strutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -1337,12 +1337,17 @@ int str_mcunames_signature(const unsigned char *sigs, int pm, char *p, size_t n)

if(!pm || (pm & PM_ALL) == PM_ALL) // Look up uP table when unrestricted by prog modes
for(size_t i=0; i < sizeof uP_table/sizeof *uP_table; i++)
if(0 == memcmp(sigs, uP_table[i].sigs, sizeof uP_table->sigs) && matching < N)
matches[matching++] = uP_table[i].name;
if(!is_memset(uP_table[i].sigs, 0xff, 3) && !is_memset(uP_table[i].sigs, 0, 3))
if(0 == memcmp(sigs, uP_table[i].sigs, sizeof uP_table->sigs) && matching < N)
matches[matching++] = uP_table[i].name;

for(LNODEID lp = lfirst(part_list); lp; lp = lnext(lp)) {
AVRPART *pp = ldata(lp);
if(0 == memcmp(sigs, pp->signature, 3) && (!pm || (pp->prog_modes & pm))) {
if(!*pp->id || *pp->id == '.') // Skip invalid entries
continue;
if(is_memset(pp->signature, 0xff, 3) || is_memset(pp->signature, 0, 3))
continue;
if(!memcmp(sigs, pp->signature, 3) && (!pm || (pp->prog_modes & pm))) {
for(k = 0; k < matching; k++)
if(str_eq(matches[k], pp->desc))
break;
Expand Down

0 comments on commit 43c915a

Please sign in to comment.