mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Prevent Data Matrix buffer overflow bug
Fixes #176 reported by Daniel Gredler at OkapiBarcode
This commit is contained in:
parent
6954497fc1
commit
257da3fff5
@ -756,7 +756,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
|
||||
process_buffer[*process_p] = value;
|
||||
(*process_p)++;
|
||||
|
||||
if (*process_p >= 3) {
|
||||
while (*process_p >= 3) {
|
||||
int iv;
|
||||
|
||||
iv = (1600 * process_buffer[0]) + (40 * process_buffer[1]) + (process_buffer[2]) + 1;
|
||||
@ -824,7 +824,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
|
||||
process_buffer[*process_p] = value;
|
||||
(*process_p)++;
|
||||
|
||||
if (*process_p >= 3) {
|
||||
while (*process_p >= 3) {
|
||||
int iv;
|
||||
|
||||
iv = (1600 * process_buffer[0]) + (40 * process_buffer[1]) + (process_buffer[2]) + 1;
|
||||
@ -885,7 +885,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
|
||||
process_buffer[*process_p] = value;
|
||||
(*process_p)++;
|
||||
|
||||
if (*process_p >= 3) {
|
||||
while (*process_p >= 3) {
|
||||
int iv;
|
||||
|
||||
iv = (1600 * process_buffer[0]) + (40 * process_buffer[1]) + (process_buffer[2]) + 1;
|
||||
@ -932,7 +932,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
|
||||
sp++;
|
||||
}
|
||||
|
||||
if (*process_p >= 4) {
|
||||
while (*process_p >= 4) {
|
||||
target[tp] = (unsigned char) ((process_buffer[0] << 2) + ((process_buffer[1] & 0x30) >> 4));
|
||||
tp++;
|
||||
target[tp] = ((process_buffer[1] & 0x0f) << 4) + ((process_buffer[2] & 0x3c) >> 2);
|
||||
|
Loading…
Reference in New Issue
Block a user