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
12431243 static char * headroom(void)
12441244 {
12451245 if (min_headroom < MIN_HEADROOM) {
1246− static char buff[10];
1246+ static char buff[16];
12471247 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);
12491249 return buff;
12501250 }
12511251 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