Assure NULL terminated strings in winradio file.

Various strncpy operations could result in a port pathname that is not a
NULL terminated string as the allowed string length is the same size as
the buffer per the strncpy manual page.  This is corrected by assuring
that the allowed length is FILPATHLEN - 1.
Hamlib-1.2.15
Nate Bargmann 2012-01-07 21:55:37 -06:00
rodzic 0c525a64e2
commit 4863209a07
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -46,7 +46,7 @@
int wr_rig_init(RIG *rig) {
rig->state.rigport.type.rig = RIG_PORT_DEVICE;
strncpy(rig->state.rigport.pathname, DEFAULT_WINRADIO_PATH, FILPATHLEN);
strncpy(rig->state.rigport.pathname, DEFAULT_WINRADIO_PATH, FILPATHLEN - 1);
return RIG_OK;
}