Fix GH-37: decryption of an encrypted empty string returns false (#50)

Closes GH-50
This commit is contained in:
Jakub Zelenka 2025-03-18 14:54:49 +01:00 committed by GitHub
parent d3bbfee186
commit c365ff0835
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 34 additions and 5 deletions

10
gnupg.c
View file

@ -1705,11 +1705,13 @@ PHP_FUNCTION(gnupg_decrypt)
return;
}
userret = gpgme_data_release_and_get_mem(out, &ret_size);
gpgme_data_release(in);
PHPC_CSTRL_RETVAL(userret, ret_size);
free(userret);
if (ret_size < 1) {
RETVAL_FALSE;
if (userret != NULL) {
PHPC_CSTRL_RETVAL(userret, ret_size);
free(userret);
} else {
PHPC_CSTR_EMPTY_RETVAL();
}
}
/* }}} */