Skip to content

Commit 256481c

Browse files
committed
Fix error (if input buffer diff than output buffer, NG)
1 parent eb3cbf0 commit 256481c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/se/drivers/default/lmic_se_default.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,11 @@ LMIC_SecureElement_Default_decodeJoinAccept(
417417
if (joinFormat != LMIC_SecureElement_JoinFormat_JoinRequest10) {
418418
return LMIC_SecureElement_Error_InvalidParameter;
419419
}
420+
// for API reasons, we have to allow input and output buffers
421+
// to be different. But we know they'll often be the same, and
422+
// in our case, we can work in place.
420423
if (pJoinAcceptClearText != pJoinAcceptBytes) {
421-
os_copyMem(pJoinAcceptClearText, pJoinAcceptClearText, nJoinAcceptBytes);
424+
os_copyMem(pJoinAcceptClearText, pJoinAcceptBytes, nJoinAcceptBytes);
422425
}
423426
aes_encrypt(pJoinAcceptClearText+1, nJoinAcceptBytes-1);
424427
if( !aes_verifyMic0(pJoinAcceptClearText, nJoinAcceptBytes-4) ) {

0 commit comments

Comments
 (0)