From 744a71ce08f3cb2d3fca9c70cc79d54e55c0d112 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Mon, 4 May 2020 15:01:27 +0200 Subject: [PATCH] vfs301: Assert hex string has 2 or more characters Otherwise static analysis thinks we may end up allocating a 0 byte output buffer. --- libfprint/drivers/vfs301_proto.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libfprint/drivers/vfs301_proto.c b/libfprint/drivers/vfs301_proto.c index 2bf8bbd2..c272659f 100644 --- a/libfprint/drivers/vfs301_proto.c +++ b/libfprint/drivers/vfs301_proto.c @@ -177,6 +177,7 @@ translate_str (const char **srcL, gssize *len) src_len += tmp; } + g_assert (src_len >= 2); *len = src_len / 2; res = g_malloc0 (*len); dst = res;