void-packages/srcpkgs/pev/patches/0012-peres-Fix-unitialized-memory-issues.-Fixes-122.patch
Đoàn Trần Công Danh c289bc2767 pev: fix crash with -D_FORTIFY_SOURCE=2
While we're at it, correct plugins dir, license, and fix musl build.

Fix: #22604
2020-06-08 07:42:37 +02:00

32 lines
1,012 B
Diff

From be991e88c2605fb6013cd24d876acbacf37f6c33 Mon Sep 17 00:00:00 2001
From: Jardel Weyrich <jweyrich@gmail.com>
Date: Tue, 30 Jul 2019 16:01:57 -0300
Subject: [PATCH 12/12] peres: Fix unitialized memory issues. Fixes #122.
---
src/peres.c | 2 ++
1 file changed, 2 insertions(+)
diff --git src/peres.c src/peres.c
index 47fdaf4..249521c 100644
--- src/peres.c
+++ src/peres.c
@@ -315,6 +315,7 @@ static NODE_PERES * createNode(NODE_PERES *currentNode, NODE_TYPE_PERES typeOfNe
{
assert(currentNode != NULL);
NODE_PERES *newNode = malloc_s(sizeof(NODE_PERES));
+ memset(newNode, 0, sizeof(*newNode));
newNode->lastNode = currentNode;
newNode->nextNode = NULL;
newNode->nodeType = typeOfNextNode;
@@ -634,6 +635,7 @@ static NODE_PERES * discoveryNodesPeres(pe_ctx_t *ctx)
}
NODE_PERES *node = malloc_s(sizeof(NODE_PERES));
+ memset(node, 0, sizeof(*node));
node->lastNode = NULL; // root
node->nodeType = RDT_RESOURCE_DIRECTORY;
node->nodeLevel = RDT_LEVEL1;
--
2.26.2.672.g232c24e857