diff options
author | Dario Lombardo <lomato@gmail.com> | 2016-10-25 14:32:44 +0200 |
---|---|---|
committer | Dario Lombardo <lomato@gmail.com> | 2016-10-27 12:33:41 +0000 |
commit | 94b4617acaf2a8c8108aa16841d2a321b93623d9 (patch) | |
tree | ff04bdc663a87f6e538f594c09ef9cd41705df37 | |
parent | 428c631b69ffc506abe475335596f4064eed4260 (diff) |
wsutil: add check for input pointers to ws_strtoi functions.
Change-Id: I7353a3b00392aa606fad04ef76e8b18ffbabbf5e
Reviewed-on: https://code.wireshark.org/review/18449
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
-rw-r--r-- | wsutil/strtoi.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/wsutil/strtoi.c b/wsutil/strtoi.c index c855466d43..1635cab5e1 100644 --- a/wsutil/strtoi.c +++ b/wsutil/strtoi.c @@ -32,6 +32,13 @@ gboolean ws_strtoi64(const gchar* str, const gchar** endptr, gint64* cint) gchar* end; gint64 val; + g_assert(cint); + + if (!str) { + errno = EINVAL; + return FALSE; + } + errno = 0; val = g_ascii_strtoll(str, &end, 10); if ((val == 0 && end == str) || (endptr == NULL && *end != '\0')) { @@ -112,6 +119,13 @@ static gboolean ws_basestrtou64(const gchar* str, const gchar** endptr, guint64* gchar* end; guint64 val; + g_assert(cint); + + if (!str) { + errno = EINVAL; + return FALSE; + } + if (str[0] == '-' || str[0] == '+') { /* * Unsigned numbers don't have a sign. |