diff options
author | Harald Welte <laforge@gnumonks.org> | 2018-08-11 13:58:57 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-08-11 14:09:14 +0000 |
commit | 1d68468636e789555bee99e1d040b0648d1f02c3 (patch) | |
tree | 58c6294d763d7efa83618656b6a5292d816e1942 /src/host/layer23 | |
parent | d68833cd854b0a47876fea0a180a21c24916c392 (diff) |
layer23: Fix possible buffer overflow writing NUL beyond end of string
settings.c: In function ‘gsm_random_imei’:
settings.c:188:26: warning: ‘sprintf’ may write a terminating nul past the end of the destination [-Wformat-overflow=]
sprintf(rand + 8, "%07ld", random() % 10000000);
^
settings.c:188:2: note: ‘sprintf’ output between 8 and 9 bytes into a destination of size 8
sprintf(rand + 8, "%07ld", random() % 10000000);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Change-Id: Id949487111235cd4af5ff068f1dce2f4b0801480
Diffstat (limited to 'src/host/layer23')
-rw-r--r-- | src/host/layer23/src/mobile/settings.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/host/layer23/src/mobile/settings.c b/src/host/layer23/src/mobile/settings.c index 7137761d..a4bb4e36 100644 --- a/src/host/layer23/src/mobile/settings.c +++ b/src/host/layer23/src/mobile/settings.c @@ -178,7 +178,7 @@ char *gsm_check_imei(const char *imei, const char *sv) int gsm_random_imei(struct gsm_settings *set) { int digits = set->imei_random; - char rand[16]; + char rand[16+1]; if (digits <= 0) return 0; |