mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Initialize local variable
In `aztec_text_process`, `binary_string`, which aliases to `aztec`'s `bit_pattern` has it's first element set to NUL. However, when the string is later written into using `bin_append_posn`, that NUL is overwritten and further NUL to replace it is not appended. In general, the garbage collected memory content should never be assumed to have a specific value unless a value was explicitly assigned, so the content of `bit_pattern` cannot be safely assumed to be NUL. If the string is not NUL terminated, functions relying on NUL termination, such as the printf call at the end of `aztec_text_proccess` itself, will overrun the array bounds. Explicitly initialize `bit_pattern`
This commit is contained in:
parent
32af280254
commit
6673289944
@ -852,6 +852,7 @@ INTERNAL int aztec(struct zint_symbol *symbol, unsigned char source[], int lengt
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
memset(adjusted_string, 0, AZTEC_MAX_CAPACITY);
|
memset(adjusted_string, 0, AZTEC_MAX_CAPACITY);
|
||||||
|
memset(bit_pattern, 0, AZTEC_MAP_POSN_MAX + 1);
|
||||||
|
|
||||||
if ((symbol->input_mode & 0x07) == GS1_MODE) {
|
if ((symbol->input_mode & 0x07) == GS1_MODE) {
|
||||||
gs1 = 1;
|
gs1 = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user