kopia lustrzana https://github.com/Hamlib/Hamlib
Assure NULL terminated strings in rigctl/rigctld
The -r, -p , and -d options 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
rodzic
7bf119716b
commit
b54932ec96
|
@ -271,7 +271,7 @@ int main (int argc, char *argv[])
|
|||
}
|
||||
|
||||
if (rig_file)
|
||||
strncpy(my_rig->state.rigport.pathname, rig_file, FILPATHLEN);
|
||||
strncpy(my_rig->state.rigport.pathname, rig_file, FILPATHLEN - 1);
|
||||
|
||||
/*
|
||||
* ex: RIG_PTT_PARALLEL and /dev/parport0
|
||||
|
@ -281,9 +281,9 @@ int main (int argc, char *argv[])
|
|||
if (dcd_type != RIG_DCD_NONE)
|
||||
my_rig->state.dcdport.type.dcd = dcd_type;
|
||||
if (ptt_file)
|
||||
strncpy(my_rig->state.pttport.pathname, ptt_file, FILPATHLEN);
|
||||
strncpy(my_rig->state.pttport.pathname, ptt_file, FILPATHLEN - 1);
|
||||
if (dcd_file)
|
||||
strncpy(my_rig->state.dcdport.pathname, dcd_file, FILPATHLEN);
|
||||
strncpy(my_rig->state.dcdport.pathname, dcd_file, FILPATHLEN - 1);
|
||||
/* FIXME: bound checking and port type == serial */
|
||||
if (serial_rate != 0)
|
||||
my_rig->state.rigport.parm.serial.rate = serial_rate;
|
||||
|
|
|
@ -304,7 +304,7 @@ int main (int argc, char *argv[])
|
|||
}
|
||||
|
||||
if (rig_file)
|
||||
strncpy(my_rig->state.rigport.pathname, rig_file, FILPATHLEN);
|
||||
strncpy(my_rig->state.rigport.pathname, rig_file, FILPATHLEN - 1);
|
||||
|
||||
/*
|
||||
* ex: RIG_PTT_PARALLEL and /dev/parport0
|
||||
|
@ -314,9 +314,9 @@ int main (int argc, char *argv[])
|
|||
if (dcd_type != RIG_DCD_NONE)
|
||||
my_rig->state.dcdport.type.dcd = dcd_type;
|
||||
if (ptt_file)
|
||||
strncpy(my_rig->state.pttport.pathname, ptt_file, FILPATHLEN);
|
||||
strncpy(my_rig->state.pttport.pathname, ptt_file, FILPATHLEN - 1);
|
||||
if (dcd_file)
|
||||
strncpy(my_rig->state.dcdport.pathname, dcd_file, FILPATHLEN);
|
||||
strncpy(my_rig->state.dcdport.pathname, dcd_file, FILPATHLEN - 1);
|
||||
/* FIXME: bound checking and port type == serial */
|
||||
if (serial_rate != 0)
|
||||
my_rig->state.rigport.parm.serial.rate = serial_rate;
|
||||
|
|
Ładowanie…
Reference in New Issue