mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
UPCEAN: Check for multiple + characters in input
Fixes #181 reported by Christian Hartlage
This commit is contained in:
parent
0c5dc4d030
commit
ee291e45d6
@ -698,7 +698,7 @@ INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int src_le
|
||||
unsigned char first_part[20] = {0}, second_part[20] = {0}, dest[1000] = {0};
|
||||
unsigned char local_source[20] = {0};
|
||||
unsigned int latch, reader, writer, with_addon;
|
||||
int error_number, i;
|
||||
int error_number, i, plus_count;
|
||||
|
||||
|
||||
with_addon = FALSE;
|
||||
@ -723,6 +723,18 @@ INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int src_le
|
||||
return error_number;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for multiple '+' characters */
|
||||
plus_count = 0;
|
||||
for (i = 0; i < src_len; i++) {
|
||||
if (source[i] == '+') {
|
||||
plus_count++;
|
||||
}
|
||||
}
|
||||
if (plus_count > 1) {
|
||||
strcpy(symbol->errtxt, "293: Invalid add-on data");
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
/* Add leading zeroes */
|
||||
ustrcpy(local_source, (unsigned char *) "");
|
||||
|
Loading…
Reference in New Issue
Block a user