Blame SOURCES/libpwquality-1.4.0-covscan.patch

8a9ed9
From fbf963dde2cbe34dba1df269b9506f4a55c39357 Mon Sep 17 00:00:00 2001
8a9ed9
From: Tomas Mraz <tmraz@fedoraproject.org>
8a9ed9
Date: Mon, 22 Oct 2018 16:29:31 +0200
8a9ed9
Subject: [PATCH] Use calloc() instead of malloc() in distcalculate to
8a9ed9
 initialize the memory.
8a9ed9
8a9ed9
---
8a9ed9
 src/check.c | 4 ++--
8a9ed9
 1 file changed, 2 insertions(+), 2 deletions(-)
8a9ed9
8a9ed9
diff --git a/src/check.c b/src/check.c
8a9ed9
index ac7cbd5..61218a7 100644
8a9ed9
--- a/src/check.c
8a9ed9
+++ b/src/check.c
8a9ed9
@@ -96,12 +96,12 @@ distance(const char *old, const char *new)
8a9ed9
 
8a9ed9
         m = strlen(old);
8a9ed9
         n = strlen(new);
8a9ed9
-        distances = malloc(sizeof(int*) * (m + 1));
8a9ed9
+        distances = calloc(m + 1, sizeof(int*));
8a9ed9
         if (distances == NULL)
8a9ed9
                 return -1;
8a9ed9
 
8a9ed9
         for (i = 0; i <= m; i++) {
8a9ed9
-                distances[i] = malloc(sizeof(int) * (n + 1));
8a9ed9
+                distances[i] = calloc(n + 1, sizeof(int));
8a9ed9
                 if (distances[i] == NULL)
8a9ed9
                         goto allocfail;
8a9ed9
 
8a9ed9
-- 
8a9ed9
2.14.5
8a9ed9