Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-alsa-utils: Commit

external/alsa-utils


Commit MetaInfo

Revisiónac82b651676303e0689b1c23ad72aaf7b264ce5f (tree)
Tiempo2019-11-21 03:46:55
AutorRosen Penev <rosenp@gmai...>
CommiterTakashi Iwai

Log Message

aplay: Adjust buffer sizes to fix snprintf warnings

It also reduces compiled size slightly.

aplay.c: In function 'capture':
aplay.c:3055:34: error: '-01' directive output may be truncated writing 3
bytes into a region of size between 1 and 4097 [-Werror=format-truncation=
]

3055 | snprintf(namebuf, namelen, "%s-01", buf);
|

aplay.c:3055:4: note: 'snprintf' output between 4 and 4100 bytes into a
destination of size 4097

3055 | snprintf(namebuf, namelen, "%s-01", buf);
| ~

aplay.c:3053:34: error: '-01.' directive output may be truncated writing 4
bytes into a region of size between 1 and 4097 [-Werror=format-truncation=
]

3053 | snprintf(namebuf, namelen, "%s-01.%s", buf, s);
| ~

aplay.c:3053:4: note: 'snprintf' output 5 or more bytes (assuming 4101)
into a destination of size 4097

3053 | snprintf(namebuf, namelen, "%s-01.%s", buf, s);
| ~

aplay.c:3065:34: error: '%02i' directive output may be truncated writing
between 2 and 10 bytes into a region of size between 0 and 4096 [-Werror=
format-truncation=]

3065 | snprintf(namebuf, namelen, "%s-%02i", buf, filecount);
| ~

aplay.c:3065:30: note: directive argument in the range [1, 2147483647]

3065 | snprintf(namebuf, namelen, "%s-%02i", buf, filecount);
|

aplay.c:3065:3: note: 'snprintf' output between 4 and 4108 bytes into a
destination of size 4097

3065 | snprintf(namebuf, namelen, "%s-%02i", buf, filecount);
|

aplay.c:3063:34: error: '%02i' directive output may be truncated writing
between 2 and 10 bytes into a region of size between 0 and 4096 [-Werror=
format-truncation=]

3063 | snprintf(namebuf, namelen, "%s-%02i.%s", buf, filecount, s);
| ~

aplay.c:3063:30: note: directive argument in the range [1, 2147483647]

3063 | snprintf(namebuf, namelen, "%s-%02i.%s", buf, filecount, s);
| ~

aplay.c:3063:3: note: 'snprintf' output 5 or more bytes (assuming 4109)
into a destination of size 4097

3063 | snprintf(namebuf, namelen, "%s-%02i.%s", buf, filecount, s);

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

Cambiar Resumen

Diferencia

--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -3015,7 +3015,7 @@ static int new_capture_file(char *name, char *namebuf, size_t namelen,
30153015 int filecount)
30163016 {
30173017 char *s;
3018- char buf[PATH_MAX+1];
3018+ char buf[PATH_MAX-10];
30193019 time_t t;
30203020 struct tm *tmp;
30213021
@@ -3122,7 +3122,7 @@ static void capture(char *orig_name)
31223122 int tostdout=0; /* boolean which describes output stream */
31233123 int filecount=0; /* number of files written */
31243124 char *name = orig_name; /* current filename */
3125- char namebuf[PATH_MAX+1];
3125+ char namebuf[PATH_MAX+2];
31263126 off64_t count, rest; /* number of bytes to capture */
31273127 struct stat statbuf;
31283128
Show on old repository browser