Skip to content

Commit

Permalink
Merge pull request #1166 from gszy/prevent-segfault-on-null-params
Browse files Browse the repository at this point in the history
Fixed segfault if chip was not found in chip config files
  • Loading branch information
Nightwalker-87 authored Aug 1, 2021
2 parents 265b716 + 1dd94a1 commit 50069e3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/stlink-lib/chipid.c
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,9 @@ struct stlink_chipid_params *stlink_chipid_get_params(uint32_t chipid) {
p2 = stlink_chipid_get_params_old(chipid);

#if 1
if (memcmp (p2, params, sizeof (struct stlink_chipid_params) - sizeof (struct stlink_chipid_params *)) != 0) {
if (params == NULL) {
params = p2;
} else if (memcmp (p2, params, sizeof (struct stlink_chipid_params) - sizeof (struct stlink_chipid_params *)) != 0) {
//fprintf (stderr, "Error, chipid params not identical\n");
//return NULL;
fprintf(stderr, "---------- old ------------\n");
Expand Down

0 comments on commit 50069e3

Please sign in to comment.