forked from pool/alsa-utils
Takashi Iwai
7200ea9d85
- Backport upstream patches: A few portability fixes, alsaucm fixes and extensions, alsatplg minor fixes, alsa-info.sh extensions: 0001-treewide-sys-poll-to-poll.patch 0002-treewide-Fix-wrong-formats-on-32-bit.patch 0003-treewide-Fix-printf-formats.patch 0004-aplay-Adjust-buffer-sizes-to-fix-snprintf-warnings.patch 0005-aplay-Limit-VUMeter-progress-bar-to-100-for-negative.patch 0006-alsactl-sysfs-add-sys-kernel-uevent_seqnum-check-to-.patch 0007-alsaucm-use-the-first-sound-card-use-case-name-hw-CA.patch 0008-alsaucm-add-text-dump-command.patch 0009-alsaucm-add-json-dump-command.patch 0010-alsaucm-dump-fix-the-prefixed.patch 0011-alsactl-fix-sched-idle-set-it-really-to-SCHED_IDLE.patch 0012-configure-Fix-linking-of-alsatplg-with-the-older-lib.patch 0013-alsatplg-add-n-normalize-option.patch 0014-alsatplg-add-s-sort-and-fix-memory-leaks.patch 0015-alsatplg-fix-another-small-leak-in-normalize_config.patch 0016-alsa-info.sh-Consolidate-PCI-device-output.patch 0017-alsa-info.sh-Read-from-proc-modules-and-sort-the-res.patch 0018-alsa-info.sh-Simplify-iteration-over-cards-when-call.patch 0019-alsa-info.sh-Use-existing-function-to-print-ALSA-con.patch 0020-alsa-info.sh-Exit-script-after-writing-information-t.patch 0021-alsa-info.sh-Replace-gauge-with-infobox-for-upload-d.patch 0022-alsa-info.sh-Remove-progress-spinner-during-upload-w.patch 0023-alsa-info.sh-Condense-nested-commands-for-file-uploa.patch 0024-alsa-info.sh-Condense-nested-commands-for-formatting.patch 0025-alsa-info.sh-Perform-test-for-wget-earlier.patch 0026-alsa-info.sh-Warn-after-actual-upload-failure-do-not.patch OBS-URL: https://build.opensuse.org/request/show/766332 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=165
82 lines
3.4 KiB
Diff
82 lines
3.4 KiB
Diff
From ac82b651676303e0689b1c23ad72aaf7b264ce5f Mon Sep 17 00:00:00 2001
|
|
From: Rosen Penev <rosenp@gmail.com>
|
|
Date: Wed, 20 Nov 2019 10:19:20 -0800
|
|
Subject: [PATCH 04/26] 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>
|
|
---
|
|
aplay/aplay.c | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/aplay/aplay.c b/aplay/aplay.c
|
|
index 72fa5676172f..78adee2fa380 100644
|
|
--- a/aplay/aplay.c
|
|
+++ b/aplay/aplay.c
|
|
@@ -3015,7 +3015,7 @@ static int new_capture_file(char *name, char *namebuf, size_t namelen,
|
|
int filecount)
|
|
{
|
|
char *s;
|
|
- char buf[PATH_MAX+1];
|
|
+ char buf[PATH_MAX-10];
|
|
time_t t;
|
|
struct tm *tmp;
|
|
|
|
@@ -3122,7 +3122,7 @@ static void capture(char *orig_name)
|
|
int tostdout=0; /* boolean which describes output stream */
|
|
int filecount=0; /* number of files written */
|
|
char *name = orig_name; /* current filename */
|
|
- char namebuf[PATH_MAX+1];
|
|
+ char namebuf[PATH_MAX+2];
|
|
off64_t count, rest; /* number of bytes to capture */
|
|
struct stat statbuf;
|
|
|
|
--
|
|
2.16.4
|
|
|