Check whether serial_serno is not NULL before calling it.

For devices connected through a real serial device rather than
USB, there is no transport-layer serial number available.

stk500v2.c (and jtag3.c) tried to always call this function.

Closes #1254
This commit is contained in:
Joerg Wunsch 2023-01-01 22:23:44 +01:00
parent b2c03f5d40
commit 06e999b8c5
3 changed files with 5 additions and 2 deletions

1
NEWS
View File

@ -122,6 +122,7 @@ Changes since version 7.0:
- megaAVR JTAG programming doesn't work for SNAP and PICkit4
#1052
- urclock/FTDI communication issues #1245
- stk500v2.c dumps core on open #1254
* Pull requests:

View File

@ -1570,7 +1570,8 @@ int jtag3_open_common(PROGRAMMER *pgm, const char *port) {
}
// Get USB serial number
pgm->usbsn = serial_serno();
if (serial_serno)
pgm->usbsn = serial_serno();
/*
* drain any extraneous input

View File

@ -1579,7 +1579,8 @@ static int stk500v2_open(PROGRAMMER *pgm, const char *port) {
}
// Get USB serial number
pgm->usbsn = serial_serno();
if (serial_serno)
pgm->usbsn = serial_serno();
/*
* drain any extraneous input