Skip to content

Commit

Permalink
libwacom: only memcmp the led data if we have leds
Browse files Browse the repository at this point in the history
../libwacom/libwacom.c:498:13: runtime error: null pointer passed as argument 1, which is declared to never be null
/usr/include/string.h:65:33: note: nonnull attribute specified here
  • Loading branch information
whot committed Nov 21, 2023
1 parent 8ffa4ec commit 3881dc7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libwacom/libwacom.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,8 @@ libwacom_compare(const WacomDevice *a, const WacomDevice *b, WacomCompareFlags f
if (a->status_leds->len != b->status_leds->len)
return 1;

if (memcmp(a->status_leds->data, b->status_leds->data,
if (a->status_leds->len > 0 &&
memcmp(a->status_leds->data, b->status_leds->data,
sizeof(WacomStatusLEDs) * a->status_leds->len) != 0)
return 1;

Expand Down

0 comments on commit 3881dc7

Please sign in to comment.