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
+3 -1
View File
@@ -664,10 +664,12 @@ ykpiv_rc ykpiv_verify(ykpiv_state *state, const char *pin, int *tries) {
apdu.st.p1 = 0x00;
apdu.st.p2 = 0x80;
apdu.st.lc = pin ? 0x08 : 0;
if(pin) {
memcpy(apdu.st.data, pin, len);
if(pin && len < 8) {
if(len < 8) {
memset(apdu.st.data + len, 0xff, 8 - len);
}
}
if((res = send_data(state, &apdu, data, &recv_len, &sw)) != YKPIV_OK) {
return res;
} else if(sw == 0x9000) {