Merge branch 'develop' into fix-cmake-else-warn2

pull/1309/head
nightwalker-87 2023-04-29 23:16:27 +02:00 zatwierdzone przez GitHub
commit fe939f73b1
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 10 dodań i 4 usunięć

Wyświetl plik

@ -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;
}

Wyświetl plik

@ -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);
}

Wyświetl plik

@ -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