kopia lustrzana https://github.com/stlink-org/stlink
Merge branch 'develop' into fix-cmake-else-warn2
commit
fe939f73b1
|
@ -591,7 +591,8 @@ int main(int argc, char **argv) {
|
|||
if (!(stlink->chip_flags & CHIP_F_HAS_SWO_TRACING)) {
|
||||
const struct stlink_chipid_params *params =
|
||||
stlink_chipid_get_params(stlink->chip_id);
|
||||
ELOG("We do not support SWO output for device '%s'\n", params->dev_type);
|
||||
ELOG("We do not support SWO output for device '%s'\n",
|
||||
params ? params->dev_type : "");
|
||||
if (!settings.force)
|
||||
return APP_RESULT_STLINK_UNSUPPORTED_DEVICE;
|
||||
}
|
||||
|
|
|
@ -160,8 +160,10 @@ int parse_options(int argc, char** argv, st_state_t *st) {
|
|||
|
||||
break;
|
||||
case 'p':
|
||||
sscanf(optarg, "%i", &q);
|
||||
if (q < 0) {
|
||||
if (sscanf(optarg, "%i", &q) != 1) {
|
||||
fprintf(stderr, "Invalid port %s\n", optarg);
|
||||
exit(EXIT_FAILURE);
|
||||
} else if (q < 0) {
|
||||
fprintf(stderr, "Can't use a negative port to listen on: %d\n", q);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
|
|
@ -64,7 +64,10 @@ void process_chipfile(char *fname) {
|
|||
(strncmp(buf, " ", strlen(" ")) == 0))
|
||||
continue; // ignore empty lines
|
||||
|
||||
sscanf(buf, "%s %s", word, value);
|
||||
if (sscanf(buf, "%63s %63s", word, value) != 2) {
|
||||
fprintf(stderr, "Failed to read keyword or value\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmp(word, "dev_type") == 0) {
|
||||
buf[strlen(buf) - 1] = 0; // chomp newline
|
||||
|
|
Ładowanie…
Reference in New Issue