Fix UB warning in md5.c

Was: pointer subtraction with a null pointer
master
Nicolas Favre-Felix 1 year ago
parent 90b8e2c023
commit 8eef97288b
No known key found for this signature in database
GPG Key ID: C04E7AA8B6F73372

@ -53,6 +53,7 @@
#include "md5.h"
#include <string.h>
#include <stdint.h>
#undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */
#ifdef ARCH_IS_BIG_ENDIAN
@ -161,7 +162,7 @@ md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
* On little-endian machines, we can process properly aligned
* data without copying it.
*/
if (!((data - (const md5_byte_t *)0) & 3)) {
if (!((uintptr_t)data & (4 - 1))) {
/* data are properly aligned */
X = (const md5_word_t *)data;
} else {

Loading…
Cancel
Save