mobile/gsm322.c: prevent calling memset() with zero length

This change prevents a possibility of calling memset()
with constant zero length parameter, and the corresponding
compiler warning.

Change-Id: I2d8d78474614939659a7f24d5007b1c890776b1a
This commit is contained in:
Vadim Yanitskiy 2017-11-02 17:51:19 +07:00 committed by Harald Welte
parent 52fbe66ca7
commit 43ecde0fce
1 changed files with 4 additions and 0 deletions

View File

@ -320,6 +320,10 @@ static char *bargraph(int value, int min, int max)
else
value -= min;
/* Prevent calling memset() with zero length */
if (value == 0)
return "";
memset(bar, '=', value);
bar[value] = '\0';