From 14f27b4e3b009d10bb9a3b43b74585c73a7c7626 Mon Sep 17 00:00:00 2001 From: Michal Schmidt Date: Tue, 21 Oct 2014 14:36:03 +0200 Subject: strv: use realloc_multiply() to check for multiplication overflow This could overflow on 32bit, where size_t is the same as unsigned. --- src/shared/strv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/shared/strv.c') diff --git a/src/shared/strv.c b/src/shared/strv.c index efa648df88..00857e40a7 100644 --- a/src/shared/strv.c +++ b/src/shared/strv.c @@ -392,7 +392,7 @@ int strv_push(char ***l, char *value) { if (m < n) return -ENOMEM; - c = realloc(*l, sizeof(char*) * (size_t) m); + c = realloc_multiply(*l, sizeof(char*), m); if (!c) return -ENOMEM; -- cgit v1.2.3-54-g00ecf