Avoid buffer overflow with UTF-8 32-bit strings
PATCH 1/1 Avoid buffer overflow with UTF-8 32-bit strings
As Winfried <[email protected]> pointed, me UTF-8 can have up to 32 bits.
Also, someone might want to convert data to UCS-4, So, the buffer need to have 4 bytes per char, to be safe.
Signed-off-by Mauro Carvalho Chehab <[email protected]>
util/scan/scan.c +1 -1
@@ -884,7 +884,7 @@ static void descriptorcpy(char **dest, c* Destination length should be bigger. As the worse case seems to * use 3 chars for one code, use it for destlen */ - destlen = len *3 ; + destlen = len *4 ; *dest =malloc (destlen +1 );/* Remove special chars */