zint / zint-gpl-only

Zint Barcode Generator
https://zint.org.uk/
GNU General Public License v3.0
525 stars 138 forks source link

ZBarcode_Clear doesn't properly clear text #45

Closed GregoryVV closed 2 years ago

GregoryVV commented 9 years ago

When calling ZBarcode_Clear, only the first character in the text is reset to '\0'. However, when reusing a Code128 symbology, the text is later overwritten character by character. As a consequence, when calling ZBarcode_Clear and then calling ZBarcode_Encode to encode a shorter code, the last characters of the previous code reappear in the text. Solution: in backend/library.c replace the line

symbol->text[0] = '\0';

with the lines

for(i = 0; i < 128; ++i) {
    symbol->text[i] = '\0';
}
gitlost commented 2 years ago

Thanks for the feedback. In the current version of Zint Zint_Clear() correctly zeroizes symbol->text, so am closing this. As this fork is no longer in use please use https://sourceforge.net/p/zint/tickets/ for any further issues, thanks!