mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 12:14:38 +02:00
Strip trailing zeroes from cert buffer when using IOTSAFE_NO_GETDATA.
This commit is contained in:
@@ -495,6 +495,17 @@ static int iotsafe_readfile(uint8_t *file_id, uint16_t file_id_sz,
|
|||||||
off += ret/2;
|
off += ret/2;
|
||||||
#ifdef IOTSAFE_NO_GETDATA
|
#ifdef IOTSAFE_NO_GETDATA
|
||||||
if (XSTRNCMP(&resp[ret-4], "0000", 4) == 0) {
|
if (XSTRNCMP(&resp[ret-4], "0000", 4) == 0) {
|
||||||
|
/* Strip trailing zeros */
|
||||||
|
for (int idx = 0; idx < off-1; idx+=2) {
|
||||||
|
if (content[idx] == 0 && content[idx+1] == 0) {
|
||||||
|
off = idx;
|
||||||
|
#ifdef DEBUG_IOTSAFE
|
||||||
|
WOLFSSL_MSG("Stripped trailing zeros from cert buffer.");
|
||||||
|
WOLFSSL_BUFFER(content, off);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -503,6 +514,7 @@ static int iotsafe_readfile(uint8_t *file_id, uint16_t file_id_sz,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return off;
|
return off;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user