# HG changeset patch # User iive # Date 1183764171 0 # Node ID 1fb5f0b13a1a5f859cd5eafff2f5cd1c27392ff8 # Parent 552963611d77c397a4ce762bddca6e7ec1f56af1 Fix crash on some DVDs sprintf(tmp,"%.02x",(char)0xef); would print "ffffffef" instead of "ef", in this case this leads to local array buffer overflow and hard to trace stack corruption. The quick, easy & durty solution is to use (unsigned char) or (uint8_t) Fixes Bugzilla 860 & 845 diff -r 552963611d77 -r 1fb5f0b13a1a libdvdcss/libdvdcss.c --- a/libdvdcss/libdvdcss.c Fri Jul 06 22:07:35 2007 +0000 +++ b/libdvdcss/libdvdcss.c Fri Jul 06 23:22:51 2007 +0000 @@ -404,7 +404,8 @@ uint8_t p_sector[DVDCSS_BLOCK_SIZE]; char psz_debug[PATH_MAX + 30]; char psz_key[1 + KEY_SIZE * 2 + 1]; - char *psz_title, *psz_serial; + char *psz_title; + uint8_t *psz_serial; int i; /* We read sector 0. If it starts with 0x000001ba (BE), we are @@ -462,7 +463,7 @@ } /* Get the date + serial */ - psz_serial = (char *)p_sector + 813; + psz_serial = p_sector + 813; psz_serial[16] = '\0'; /* Check that all characters are digits, otherwise convert. */