History

sox: silence gcc warning in headroom() function

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

Mans Rullgard committed 6 years ago

Commit 9f2d60f1 parent 42d30cf1 file · +2 −2Browse files

Unified · Split

src/sox.c+2−2
@@ -1243,9 +1243,9 @@ static char const * vu(unsigned channel) · 1242 unmodified lines
1243static char * headroom(void)1243static char * headroom(void)
1244{1244{
1245 if (min_headroom < MIN_HEADROOM) {1245 if (min_headroom < MIN_HEADROOM) {
1246 static char buff[10];1246 static char buff[16];
1247 unsigned h = (unsigned)(min_headroom * 10);1247 unsigned h = (unsigned)(min_headroom * 10);
1248 sprintf(buff, "Hd:%u.%u", h /10, h % 10);1248 snprintf(buff, sizeof(buff), "Hd:%u.%u", h /10, h % 10);
1249 return buff;1249 return buff;
1250 }1250 }
1251 return " ";1251 return " ";

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t