Patch php7_upgrade for ssdeep Bug #75963
Patch version 2018-02-15 00:04 UTC
Return to Bug #75963 |
Download this patch
Patch Revisions:
Developer: andras.iklody@circl.lu
diff --git a/ssdeep.c b/ssdeep.c
index 20325bf..3cae212 100644
--- a/ssdeep.c
+++ b/ssdeep.c
@@ -101,7 +101,7 @@ PHP_MINFO_FUNCTION(ssdeep) {
PHP_FUNCTION(ssdeep_fuzzy_hash) {
char *hash = (char *) emalloc(FUZZY_MAX_RESULT);
char *to_hash;
- size_t to_hash_len;
+ int to_hash_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &to_hash, &to_hash_len) == FAILURE) {
RETURN_NULL();
@@ -110,7 +110,7 @@ PHP_FUNCTION(ssdeep_fuzzy_hash) {
if (0 != fuzzy_hash_buf((unsigned char *) to_hash, to_hash_len, hash)) {
RETURN_FALSE;
} else {
- RETURN_STRING(hash);
+ RETURN_STRING(hash, 0);
}
}
/* }}} */
@@ -120,7 +120,7 @@ PHP_FUNCTION(ssdeep_fuzzy_hash) {
PHP_FUNCTION(ssdeep_fuzzy_hash_filename) {
char *hash = (char *) emalloc(FUZZY_MAX_RESULT);
char *file_name;
- size_t file_name_len;
+ int file_name_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file_name, &file_name_len) == FAILURE) {
RETURN_NULL();
@@ -129,7 +129,7 @@ PHP_FUNCTION(ssdeep_fuzzy_hash_filename) {
if (0 != fuzzy_hash_filename(file_name, hash)) {
RETURN_FALSE;
} else {
- RETURN_STRING(hash);
+ RETURN_STRING(hash, 0);
}
}
/* }}} */
@@ -138,14 +138,16 @@ PHP_FUNCTION(ssdeep_fuzzy_hash_filename) {
*/
PHP_FUNCTION(ssdeep_fuzzy_compare) {
char *signature1 = NULL;
- size_t signature1_len;
+ int signature1_len;
char *signature2 = NULL;
- size_t signature2_len;
+ int signature2_len;
int match;
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &signature1, &signature1_len, &signature2, &signature2_len) == FAILURE) {
RETURN_NULL();
}
match = fuzzy_compare(signature1, signature2);
+
if(match < 0 || match > 100) {
RETURN_FALSE;
} else {
|