From 08930766cb8a7e76b96eed44572bc7f46979f0c6 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 23 Dec 2022 20:05:45 +0100 Subject: [PATCH] fix potential NULL array printing --- CHANGELOG.md | 1 + client/src/util.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47e2d30df..679a27524 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] + - Fixed potential NULL array printing (@jmichel) - Added PIV aid to resource file (@jmichel) - Fixed failing compilation on Proxspace environment due to how python is initialized (@jmichel) - Fixed length check in sim module communications (@jmichel) diff --git a/client/src/util.c b/client/src/util.c index e849ebb62..d6d57414d 100644 --- a/client/src/util.c +++ b/client/src/util.c @@ -303,7 +303,8 @@ void print_hex_noascii_break(const uint8_t *data, const size_t len, uint8_t brea static void print_buffer_ex(const uint8_t *data, const size_t len, int level, uint8_t breaks) { - if (len < 1) + // sanity checks + if ((data == NULL) || (len < 1)) return; char buf[UTIL_BUFFER_SIZE_SPRINT + 3];