Skip to content

Commit f9b979b

Browse files
dos1SiegeLord
authored andcommitted
oss: Fix strncpy potentially truncating NULL out of the string
oss_audio_device is 512 characters long, so we can fill at most 511.
1 parent 9334f3c commit f9b979b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

addons/audio/oss.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static int oss_open_ver4()
161161

162162
if (audioinfo.enabled) {
163163
if (strlen(audioinfo.devnode)) {
164-
strncpy(oss_audio_device, audioinfo.devnode, 512);
164+
strncpy(oss_audio_device, audioinfo.devnode, 511);
165165
}
166166
else if (audioinfo.legacy_device != -1) {
167167
sprintf(oss_audio_device, "/dev/dsp%i", audioinfo.legacy_device);
@@ -225,7 +225,7 @@ static int oss_open_ver3(void)
225225
}
226226

227227
close(fd);
228-
strncpy(oss_audio_device, oss_audio_device_ver3, 512);
228+
strncpy(oss_audio_device, oss_audio_device_ver3, 511);
229229
ALLEGRO_INFO("Using device: %s\n", oss_audio_device);
230230

231231
using_ver_4 = false;

0 commit comments

Comments
 (0)