mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Stack smashing bug fix
This commit is contained in:
parent
f7060fc642
commit
dd374c0db5
@ -628,6 +628,10 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(tp > 1558) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
} /* while */
|
} /* while */
|
||||||
|
|
||||||
/* Empty buffers */
|
/* Empty buffers */
|
||||||
@ -750,7 +754,7 @@ int data_matrix_200(struct zint_symbol *symbol, unsigned char source[])
|
|||||||
{
|
{
|
||||||
int inputlen, i;
|
int inputlen, i;
|
||||||
inputlen = ustrlen(source);
|
inputlen = ustrlen(source);
|
||||||
unsigned char binary[inputlen * 2];
|
unsigned char binary[2000];
|
||||||
int binlen;
|
int binlen;
|
||||||
int symbolsize, optionsize, calcsize;
|
int symbolsize, optionsize, calcsize;
|
||||||
int taillength, error_number = 0;
|
int taillength, error_number = 0;
|
||||||
@ -760,8 +764,8 @@ int data_matrix_200(struct zint_symbol *symbol, unsigned char source[])
|
|||||||
|
|
||||||
binlen = dm200encode(symbol, source, binary, &last_mode);
|
binlen = dm200encode(symbol, source, binary, &last_mode);
|
||||||
if(binlen == 0) {
|
if(binlen == 0) {
|
||||||
strcpy(symbol->errtxt, "Could not encode data (should never happen)");
|
strcpy(symbol->errtxt, "Data too long to fit in symbol");
|
||||||
return ERROR_ENCODING_PROBLEM;
|
return ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((symbol->option_2 >= 1) && (symbol->option_2 <= 30)) {
|
if((symbol->option_2 >= 1) && (symbol->option_2 <= 30)) {
|
||||||
@ -833,7 +837,6 @@ int data_matrix_200(struct zint_symbol *symbol, unsigned char source[])
|
|||||||
}
|
}
|
||||||
//fprintf (stderr, "\n");
|
//fprintf (stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
for(y = H - 1; y >= 0; y--) {
|
for(y = H - 1; y >= 0; y--) {
|
||||||
int x;
|
int x;
|
||||||
for(x = 0; x < W; x++) {
|
for(x = 0; x < W; x++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user