From f34c191b195e9e571ffda2fc432b29b3b6c1b845 Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Mon, 2 Oct 2017 06:47:23 +0200 Subject: [PATCH] Avoid writing uninitialized stack memory into INFO.ind and LEARN.ind (probably required because compilers do padding on structs) in order to make package builds reproducible See https://reproducible-builds.org/ for why this is good --- LiE/util/infoind.c | 1 + LiE/util/learnind.c | 1 + 2 files changed, 2 insertions(+) diff --git a/LiE/util/infoind.c b/LiE/util/infoind.c index 3caa6d5..a3c7dc0 100644 --- a/LiE/util/infoind.c +++ b/LiE/util/infoind.c @@ -70,6 +70,7 @@ int main(void) FILE *indexpt,*infopt; info_index_tp info; /* current info record */ + memset(&info, 0, sizeof(info)); strcpy(indexfil,INDEXFIL); indexpt=fopen(indexfil,writemode); if (indexpt==NULL) diff --git a/LiE/util/learnind.c b/LiE/util/learnind.c index 45fdc1a..a532fb4 100644 --- a/LiE/util/learnind.c +++ b/LiE/util/learnind.c @@ -24,6 +24,7 @@ int main(void) FILE *indexpt,*learnpt; learn_index_tp learn; + memset(&learn, 0, sizeof(learn)); strcpy(indexfil,INDEXFIL); strcpy(learnfil,LEARNFIL); learnpt=fopen(learnfil,readmode); if (learnpt==NULL)