From 5b924130851699b9247b69b8041a49adf7afda14 Mon Sep 17 00:00:00 2001 From: Harald Oehlmann Date: Tue, 18 Aug 2015 14:11:50 +0200 Subject: [PATCH] Use passed length instead of \0 to detect source string length --- backend/gs1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/gs1.c b/backend/gs1.c index ad004d36..3a7169ca 100644 --- a/backend/gs1.c +++ b/backend/gs1.c @@ -164,7 +164,7 @@ int gs1_verify(struct zint_symbol *symbol, unsigned char source[], const unsigne data_length[i] = 0; do { data_length[i]++; - } while ((source[data_location[i] + data_length[i] - 1] != '[') && (source[data_location[i] + data_length[i] - 1] != '\0')); + } while ((source[data_location[i] + data_length[i] - 1] != '[') && (data_location[i] + data_length[i] <= src_len)); data_length[i]--; }