shithub: sox

Download patch

ref: 9f2d60f9cd52a1cc5ae92e02bd862c8cb4b85f13
parent: 42d30cfc19bf2a377dbe9869dbb92bf55b34c86b
author: Mans Rullgard <mans@mansr.com>
date: Tue Dec 17 07:52:32 EST 2019

sox: silence gcc warning in headroom() function

Increase the buffer size and use snprintf() to silence gcc warning
about possible overflow/truncation.

--- a/src/sox.c
+++ b/src/sox.c
@@ -1243,9 +1243,9 @@
 static char * headroom(void)
 {
   if (min_headroom < MIN_HEADROOM) {
-    static char buff[10];
+    static char buff[16];
     unsigned h = (unsigned)(min_headroom * 10);
-    sprintf(buff, "Hd:%u.%u", h /10, h % 10);
+    snprintf(buff, sizeof(buff), "Hd:%u.%u", h /10, h % 10);
     return buff;
   }
   return "      ";