don't do memcpy with NULL argument

found with clang scan-build
This commit is contained in:
Klas Lindfors
2015-07-09 10:28:21 +02:00
parent 76e0dd5349
commit 43ffb65462
+5 -3
View File
@@ -664,9 +664,11 @@ ykpiv_rc ykpiv_verify(ykpiv_state *state, const char *pin, int *tries) {
apdu.st.p1 = 0x00; apdu.st.p1 = 0x00;
apdu.st.p2 = 0x80; apdu.st.p2 = 0x80;
apdu.st.lc = pin ? 0x08 : 0; apdu.st.lc = pin ? 0x08 : 0;
memcpy(apdu.st.data, pin, len); if(pin) {
if(pin && len < 8) { memcpy(apdu.st.data, pin, len);
memset(apdu.st.data + len, 0xff, 8 - len); if(len < 8) {
memset(apdu.st.data + len, 0xff, 8 - len);
}
} }
if((res = send_data(state, &apdu, data, &recv_len, &sw)) != YKPIV_OK) { if((res = send_data(state, &apdu, data, &recv_len, &sw)) != YKPIV_OK) {
return res; return res;