Skip to content

Commit

Permalink
Sound (NetBSD): don't assume readlink reports file name only
Browse files Browse the repository at this point in the history
  • Loading branch information
CarterLi committed Jan 26, 2025
1 parent 1c4953a commit 4e9fecc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/detection/sound/sound_bsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ const char* ffDetectSound(FFlist* devices)
#else
int defaultDev;
{
char mixerp[8];
if (readlink("/dev/mixer", mixerp, ARRAY_SIZE(mixerp)) != 6)
char mixerp[12];
ssize_t plen = readlink("/dev/mixer", mixerp, ARRAY_SIZE(mixerp));
if (plen < 6)
return "readlink(/dev/mixer) failed";
defaultDev = mixerp[5] - '0';
defaultDev = mixerp[plen - 1] - '0';
if (defaultDev < 0 || defaultDev > 9)
return "Invalid mixer device";
}
Expand Down

0 comments on commit 4e9fecc

Please sign in to comment.