Avoid 0-length memmove from buffer end to keep static analyzers happier

This avoid incorrect errors from some static analyzers that do not like
memmove with pointers just after the end of a buffer even if the number
of bytes to move is zero.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2011-11-17 19:54:26 +02:00
parent 2bb747e232
commit bfbc4284a8

View file

@ -1028,9 +1028,12 @@ void eap_sm_process_nak(struct eap_sm *sm, const u8 *nak_list, size_t len)
not_found: not_found:
/* not found - remove from the list */ /* not found - remove from the list */
os_memmove(&sm->user->methods[i], &sm->user->methods[i + 1], if (i + 1 < EAP_MAX_METHODS) {
os_memmove(&sm->user->methods[i],
&sm->user->methods[i + 1],
(EAP_MAX_METHODS - i - 1) * (EAP_MAX_METHODS - i - 1) *
sizeof(sm->user->methods[0])); sizeof(sm->user->methods[0]));
}
sm->user->methods[EAP_MAX_METHODS - 1].vendor = sm->user->methods[EAP_MAX_METHODS - 1].vendor =
EAP_VENDOR_IETF; EAP_VENDOR_IETF;
sm->user->methods[EAP_MAX_METHODS - 1].method = EAP_TYPE_NONE; sm->user->methods[EAP_MAX_METHODS - 1].method = EAP_TYPE_NONE;