Blame SOURCES/libpwquality-1.4.0-covscan.patch

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