mobile/gsm322.c: prevent buffer over-/under-run

Change-Id: Ic12587a6c6456b8663e5357cf68a22c6d1927a07
This commit is contained in:
Vadim Yanitskiy 2017-11-08 18:35:08 +07:00 committed by Harald Welte
parent 43ecde0fce
commit 3483d4d844
1 changed files with 3 additions and 0 deletions

View File

@ -320,6 +320,9 @@ static char *bargraph(int value, int min, int max)
else
value -= min;
/* Prevent 'bar' buffer over-/under-run */
OSMO_ASSERT(value >= 0 && value < 128);
/* Prevent calling memset() with zero length */
if (value == 0)
return "";