From c48759f4ba04d2c9ea0a26794fe47d9d58f38ccc Mon Sep 17 00:00:00 2001 From: Iampete1 Date: Wed, 14 Feb 2024 11:16:31 +0000 Subject: [PATCH] AP_Filesystem: crc32: Ensure checksum value is initialized --- libraries/AP_Filesystem/AP_Filesystem.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/AP_Filesystem/AP_Filesystem.cpp b/libraries/AP_Filesystem/AP_Filesystem.cpp index e62ec59208..564696bb97 100644 --- a/libraries/AP_Filesystem/AP_Filesystem.cpp +++ b/libraries/AP_Filesystem/AP_Filesystem.cpp @@ -290,6 +290,9 @@ bool AP_Filesystem::fgets(char *buf, uint8_t buflen, int fd) // run crc32 over file with given name, returns true if successful bool AP_Filesystem::crc32(const char *fname, uint32_t& checksum) { + // Ensure value is initialized + checksum = 0; + // Open file in readonly mode int fd = open(fname, O_RDONLY); if (fd == -1) {