mirror of
https://github.com/libtom/libtomcrypt
synced 2026-08-25 20:26:07 -04:00
fix UBSanitizer issue: memcpy/memcmp require non-null pointers even when the length is zero
This commit is contained in:
parent
76a9ece653
commit
5c8ac18bd1
2 changed files with 3 additions and 1 deletions
|
|
@ -161,7 +161,7 @@ static LTC_INLINE int s_siv_S2V_T(siv_omac_ctx_t *ctx,
|
|||
} else {
|
||||
s_siv_dbl(D);
|
||||
XMEMSET(&T, 0, sizeof(T));
|
||||
XMEMCPY(&T, in, inlen);
|
||||
if (inlen != 0) XMEMCPY(&T, in, inlen);
|
||||
T.u.byte[inlen] = 0x80;
|
||||
s_siv_xor_buf(D, &T);
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ int ltc_compare_testvector(const void* is, const unsigned long is_len, const voi
|
|||
int res = 0;
|
||||
if(is_len != should_len) {
|
||||
res = is_len > should_len ? -1 : 1;
|
||||
} else if (is_len == 0) {
|
||||
res = 0;
|
||||
} else {
|
||||
res = XMEMCMP(is, should, is_len);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue