From 2bcd3074cc5fed0bda36c3f8e6f8220d961c7e00 Mon Sep 17 00:00:00 2001 From: CV-GPhL Date: Wed, 4 Feb 2026 11:20:21 +0100 Subject: [PATCH] Null terminate buffer in file.c Ensure the buffer is null terminated after allocation - otherwise correct results from strcmp below is undefined. --- src/file.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/file.c b/src/file.c index a279768..720fe21 100644 --- a/src/file.c +++ b/src/file.c @@ -683,6 +683,9 @@ herr_t det_visit_callback(hid_t root_id, const char *name, ERROR_JUMP(-1, free_buffer, message); } + /* ensure the buffer is null terminated */ + buffer[H5Tget_size(t_id)] = '\0'; + /* test for NXdata or NXdetector */ { if (strcmp("NXdata", buffer) == 0) {