Increase the buffer size and use snprintf() to silence gcc warning about possible overflow/truncation.
Unified · Split
| @@ -1243,9 +1243,9 @@ static char const * vu(unsigned channel) · 1242 unmodified lines | ||
| 1243 | 1243 | static char * headroom(void) |
| 1244 | 1244 | { |
| 1245 | 1245 | if (min_headroom < MIN_HEADROOM) { |
| 1246 | − static char buff[10]; | |
| 1246 | + static char buff[16]; | |
| 1247 | 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 | 1249 | return buff; |
| 1250 | 1250 | } |
| 1251 | 1251 | return " "; |