mirror of https://github.com/FreeRDP/FreeRDP
tsmf: Prevent string overflow and unterminated strings
Device variable can overflow, or be unterminated. Replace strcpy by strncpy and be sure that the string is terminated (sizeof() - 1).
This commit is contained in:
parent
0389cb129e
commit
e2f9a08107
|
@ -72,7 +72,7 @@ static BOOL tsmf_alsa_open(ITSMFAudioDevice *audio, const char *device)
|
|||
}
|
||||
else
|
||||
{
|
||||
strncpy(alsa->device, device, sizeof(alsa->device));
|
||||
strncpy(alsa->device, device, sizeof(alsa->device) - 1);
|
||||
}
|
||||
return tsmf_alsa_open_device(alsa);
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ static BOOL tsmf_oss_open(ITSMFAudioDevice* audio, const char* device)
|
|||
}
|
||||
else
|
||||
{
|
||||
strncpy(oss->dev_name, device, sizeof(oss->dev_name));
|
||||
strncpy(oss->dev_name, device, sizeof(oss->dev_name) - 1);
|
||||
}
|
||||
|
||||
if ((oss->pcm_handle = open(oss->dev_name, O_WRONLY)) < 0)
|
||||
|
|
|
@ -115,7 +115,7 @@ static BOOL tsmf_pulse_open(ITSMFAudioDevice *audio, const char *device)
|
|||
TSMFPulseAudioDevice *pulse = (TSMFPulseAudioDevice *) audio;
|
||||
if(device)
|
||||
{
|
||||
strcpy(pulse->device, device);
|
||||
strncpy(pulse->device, device, sizeof(pulse->device) - 1);
|
||||
}
|
||||
pulse->mainloop = pa_threaded_mainloop_new();
|
||||
if(!pulse->mainloop)
|
||||
|
|
Loading…
Reference in New Issue