Fix/overflow and libgerror check (#1068)
* Fixed stack overflow caused by missing buffer space for the trailing \0 added by sprintf() Signed-off-by: Toni Uhlig <matzeton@googlemail.com> * Remove the autoconf cache value from the previous and failed check before checking again. Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
@@ -184,6 +184,7 @@ AC_ARG_ENABLE([gcrypt],
|
|||||||
if test "x$ac_cv_lib_gcrypt_gcry_cipher_checktag" = xyes; then :
|
if test "x$ac_cv_lib_gcrypt_gcry_cipher_checktag" = xyes; then :
|
||||||
ADDITIONAL_LIBS="${ADDITIONAL_LIBS} -lgcrypt"
|
ADDITIONAL_LIBS="${ADDITIONAL_LIBS} -lgcrypt"
|
||||||
else
|
else
|
||||||
|
$as_unset ac_cv_lib_gcrypt_gcry_cipher_checktag
|
||||||
AC_CHECK_LIB(gpg-error, gpg_strerror_r)
|
AC_CHECK_LIB(gpg-error, gpg_strerror_r)
|
||||||
AC_CHECK_LIB(gcrypt, gcry_cipher_checktag)
|
AC_CHECK_LIB(gcrypt, gcry_cipher_checktag)
|
||||||
if test "x$ac_cv_lib_gcrypt_gcry_cipher_checktag" = xyes -a "x$ac_cv_lib_gpg_error_gpg_strerror_r" = xyes; then :
|
if test "x$ac_cv_lib_gcrypt_gcry_cipher_checktag" = xyes -a "x$ac_cv_lib_gpg_error_gpg_strerror_r" = xyes; then :
|
||||||
|
|||||||
@@ -1139,7 +1139,7 @@ int ndpi_dpi2json(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
case NDPI_PROTOCOL_BITTORRENT:
|
case NDPI_PROTOCOL_BITTORRENT:
|
||||||
{
|
{
|
||||||
u_int i, j, n = 0;
|
u_int i, j, n = 0;
|
||||||
char bittorent_hash[32];
|
char bittorent_hash[sizeof(flow->protos.bittorrent.hash)*2+1];
|
||||||
|
|
||||||
for(i=0, j = 0; j < sizeof(bittorent_hash)-1; i++) {
|
for(i=0, j = 0; j < sizeof(bittorent_hash)-1; i++) {
|
||||||
sprintf(&bittorent_hash[j], "%02x",
|
sprintf(&bittorent_hash[j], "%02x",
|
||||||
|
|||||||
Reference in New Issue
Block a user