diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2017-11-02 17:51:19 +0700 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-11-09 03:46:41 +0000 |
commit | 43ecde0fced685bc5b4fa4818df36a6bc394df59 (patch) | |
tree | 9b873517e5e92bf5128ccf478799bffe25c7a54c /src/host/layer23/src/mobile | |
parent | 52fbe66ca7ca22a834f368bc783a3400a46fd09e (diff) |
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
Diffstat (limited to 'src/host/layer23/src/mobile')
-rw-r--r-- | src/host/layer23/src/mobile/gsm322.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/host/layer23/src/mobile/gsm322.c b/src/host/layer23/src/mobile/gsm322.c index 8311a44b..0e2c9afe 100644 --- a/src/host/layer23/src/mobile/gsm322.c +++ b/src/host/layer23/src/mobile/gsm322.c @@ -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'; |