forked from cisco/cjose
-
-
Notifications
You must be signed in to change notification settings - Fork 12
Fix functions that rely on nonportable malloc behaviour #29
Copy link
Copy link
Open
Description
From man malloc:
Nonportable behavior
The behavior of these functions when the requested size is zero is glibc specific; other implementations may return NULL without setting errno, and portable POSIX programs should tolerate such behavior.
Two unit tests with empty plain text will fail on systems where malloc(0) returns NULL, e.g., AIX:
check_jwe.c:172:F:core:test_cjose_jwe_self_encrypt_self_decrypt_empty:0: cjose_jwe_encrypt [RSA-OAEP/A128GCM] failed: out of memory, file: src/jwe.c, function: _cjose_jwe_malloc, line: 198
check_jws.c:113:F:core:test_cjose_jws_self_sign_self_verify_empty:0: cjose_jws_sign [PS256] failed: out of memory, file: src/jws.c, function: _cjose_jws_build_dat, line: 145
Also test_cjose_jwe_self_encrypt_self_decrypt_many will fail for RSA-OAEP + A128GCM if the first random byte it generates is zero.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels