summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2020-04-13 15:51:08 +0200
committerAlbert Astals Cid <aacid@kde.org>2020-04-13 15:51:08 +0200
commit3639f1fe932d8374dd482de4e01457afe3e43a34 (patch)
tree46d445ec3d2b734d2ffe67946adb1d7ce2877246
parent465a5c66e5e1ea04a8f70105b1db4ef8051c0428 (diff)
Make sure we don't read uninitialized memory from text
oss-fuzz/21670
-rw-r--r--libspectre/ps.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libspectre/ps.c b/libspectre/ps.c
index bb45c9a..03d462a 100644
--- a/libspectre/ps.c
+++ b/libspectre/ps.c
@@ -448,6 +448,10 @@ psscan(FILE *file, const char *filename, int scanstyle)
}
}
+ // Initialize text so that all the strcmp we do after sscanf don't
+ // end up reading uninitialized memory if the sscanf fails
+ text[0] = '\0';
+
/* Header comments */
/* Header should start with "%!PS-Adobe-", but some programms omit