diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2017-10-07 04:45:01 +0200 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2017-10-10 14:38:10 +0000 |
commit | 4b7c791e15e921ce5427c531f740df7474c6a1cb (patch) | |
tree | 88f296e22010fd692f9f1730791b3c159a1c5657 /src | |
parent | f624546ed1336ef2c092a254fddea6b904a9e274 (diff) |
gsm: make osmo_imsi_str_valid() NULL-safe
No callers that would pass NULL exist, but let's check against NULL from the
start.
Fixup for recent change I1e94f5b0717b947d2a7a7d36bacdf04a75cb3522.
Change-Id: I111fbf29228929f2cd6ffa06bcb1f69da223224e
Diffstat (limited to 'src')
-rw-r--r-- | src/gsm/gsm23003.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gsm/gsm23003.c b/src/gsm/gsm23003.c index 004e20ff..3c09acac 100644 --- a/src/gsm/gsm23003.c +++ b/src/gsm/gsm23003.c @@ -33,6 +33,8 @@ static bool is_n_digits(const char *str, int min_digits, int max_digits) /* Use unsigned char * to avoid a compiler warning of * "error: array subscript has type 'char' [-Werror=char-subscripts]" */ const unsigned char *pos = (const unsigned char *)str; + if (!pos) + return min_digits < 1; for (len = 0; *pos && len < max_digits; len++, pos++) if (!isdigit(*pos)) return false; |