mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-12-23 10:56:33 +01:00
aplay: Fix invalid file size check for non-regular files
aplay tries to check the file size via fstat() at parsing the format headers and avoids parsing when the size is shorter than the given size. This works fine for regular files, but when a special file like pipe is passed, it fails, eventually leading to the fallback mode wrongly. A proper fix is to do this sanity check only for a regular file. Reported-by: Jay Foster <jay@systech.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
9a6ab34203
commit
da4d5bd53a
1 changed files with 2 additions and 1 deletions
|
@ -2821,7 +2821,8 @@ static int read_header(int *loaded, int header_size)
|
||||||
|
|
||||||
/* don't be adventurous, get out if file size is smaller than
|
/* don't be adventurous, get out if file size is smaller than
|
||||||
* requested header size */
|
* requested header size */
|
||||||
if (buf.st_size < header_size)
|
if ((buf.st_mode & S_IFMT) == S_IFREG &&
|
||||||
|
buf.st_size < header_size)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (*loaded < header_size) {
|
if (*loaded < header_size) {
|
||||||
|
|
Loading…
Reference in a new issue