mirror of https://github.com/ARMmbed/mbed-os.git
nsapi - Fixed leftover bytes from suffix during ipv6 parsing
Thanks to @EduardPon for hunting this downpull/3144/head
parent
350a5a4b31
commit
8dcbf63bb6
|
@ -107,8 +107,6 @@ static void ipv6_from_address(uint8_t *bytes, const char *addr)
|
||||||
{
|
{
|
||||||
// Start with zeroed address
|
// Start with zeroed address
|
||||||
uint16_t shorts[NSAPI_IPv6_BYTES/2];
|
uint16_t shorts[NSAPI_IPv6_BYTES/2];
|
||||||
memset(shorts, 0, sizeof shorts);
|
|
||||||
|
|
||||||
int suffix = 0;
|
int suffix = 0;
|
||||||
|
|
||||||
// Find double colons and scan suffix
|
// Find double colons and scan suffix
|
||||||
|
@ -122,6 +120,8 @@ static void ipv6_from_address(uint8_t *bytes, const char *addr)
|
||||||
// Move suffix to end
|
// Move suffix to end
|
||||||
memmove(&shorts[NSAPI_IPv6_BYTES/2-suffix], &shorts[0],
|
memmove(&shorts[NSAPI_IPv6_BYTES/2-suffix], &shorts[0],
|
||||||
suffix*sizeof(uint16_t));
|
suffix*sizeof(uint16_t));
|
||||||
|
memset(&shorts[0], 0,
|
||||||
|
(NSAPI_IPv6_BYTES/2-suffix)*sizeof(uint16_t));
|
||||||
|
|
||||||
// Scan prefix
|
// Scan prefix
|
||||||
ipv6_scan_chunk(shorts, &addr[0]);
|
ipv6_scan_chunk(shorts, &addr[0]);
|
||||||
|
|
Loading…
Reference in New Issue