plessey.c: Loop will never end due to unsinged type (Bug by Philippe Leuba)

This commit is contained in:
Harald Oehlmann 2015-08-18 14:46:30 +02:00
parent bf687fc409
commit 6158a95bd5

View File

@ -386,6 +386,7 @@ int msi_plessey_mod1110(struct zint_symbol *symbol, unsigned char source[], cons
/* Weighted using the IBM system */ /* Weighted using the IBM system */
unsigned long i, weight, x, check, wright, dau, pedwar, pump, h; unsigned long i, weight, x, check, wright, dau, pedwar, pump, h;
long si;
char un[16], tri[16]; char un[16], tri[16];
int error_number; int error_number;
char dest[1000]; char dest[1000];
@ -411,8 +412,8 @@ int msi_plessey_mod1110(struct zint_symbol *symbol, unsigned char source[], cons
/* calculate first (mod 11) digit */ /* calculate first (mod 11) digit */
x = 0; x = 0;
weight = 2; weight = 2;
for(i = src_len - 1; i >= 0; i--) { for(si = src_len - 1; si >= 0; si--) {
x += weight * ctoi(source[i]); x += weight * ctoi(source[si]);
weight++; weight++;
if(weight > 7) { if(weight > 7) {
weight = 2; weight = 2;