From 1838d9f13fe8b253895f8a19a0c53c9e3056cf65 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Tue, 30 Jul 2019 20:33:20 +0200 Subject: [PATCH] hameg-hmo: Fix two compiler warnings (-Wstringop-truncation). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit src/hardware/hameg-hmo/protocol.c: In function ‘hmo_scope_state_get’: src/hardware/hameg-hmo/protocol.c:1130:2: warning: ‘strncpy’ specified bound 20 equals destination size [-Wstringop-truncation] strncpy(state->trigger_pattern, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sr_scpi_unquote_string(tmp_str), ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAX_ANALOG_CHANNEL_COUNT + MAX_DIGITAL_CHANNEL_COUNT); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CC src/hardware/hp-3478a/api.lo CC src/hardware/hung-chang-dso-2100/protocol.lo src/hardware/hameg-hmo/api.c: In function ‘config_set’: src/hardware/hameg-hmo/api.c:388:3: warning: ‘strncpy’ specified bound 20 equals destination size [-Wstringop-truncation] strncpy(state->trigger_pattern, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tmp_str, ~~~~~~~~ MAX_ANALOG_CHANNEL_COUNT + MAX_DIGITAL_CHANNEL_COUNT); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- src/hardware/hameg-hmo/protocol.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hardware/hameg-hmo/protocol.h b/src/hardware/hameg-hmo/protocol.h index 2749fb8e..af77c6da 100644 --- a/src/hardware/hameg-hmo/protocol.h +++ b/src/hardware/hameg-hmo/protocol.h @@ -106,7 +106,7 @@ struct scope_state { int trigger_source; int trigger_slope; - char trigger_pattern[MAX_ANALOG_CHANNEL_COUNT + MAX_DIGITAL_CHANNEL_COUNT]; + char trigger_pattern[MAX_ANALOG_CHANNEL_COUNT + MAX_DIGITAL_CHANNEL_COUNT + 1]; gboolean high_resolution; gboolean peak_detection;