don't do memcpy with NULL argument
found with clang scan-build
This commit is contained in:
+3
-1
@@ -664,10 +664,12 @@ 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;
|
||||||
|
if(pin) {
|
||||||
memcpy(apdu.st.data, pin, len);
|
memcpy(apdu.st.data, pin, len);
|
||||||
if(pin && len < 8) {
|
if(len < 8) {
|
||||||
memset(apdu.st.data + len, 0xff, 8 - len);
|
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;
|
||||||
} else if(sw == 0x9000) {
|
} else if(sw == 0x9000) {
|
||||||
|
|||||||
Reference in New Issue
Block a user