From 6d8610d63ecb8e53e14486533a580ea4f37c644c Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Sun, 14 Feb 2021 10:46:49 +0100 Subject: libmm-glib,common-helpers: ishexstr() fails on empty input string --- libmm-glib/mm-common-helpers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libmm-glib/mm-common-helpers.c') diff --git a/libmm-glib/mm-common-helpers.c b/libmm-glib/mm-common-helpers.c index 30f9f94f..0245fd52 100644 --- a/libmm-glib/mm-common-helpers.c +++ b/libmm-glib/mm-common-helpers.c @@ -1738,9 +1738,9 @@ mm_utils_ishexstr (const gchar *hex) gsize len; gsize i; - /* Length not multiple of 2? */ + /* Empty string or length not multiple of 2? */ len = strlen (hex); - if (len % 2 != 0) + if (len == 0 || (len % 2) != 0) return FALSE; for (i = 0; i < len; i++) { -- cgit v1.2.3-70-g09d2