net: use UNALIGNED_GET in net_addr_ntop
Use UNALIGNED_GET in net_addr_ntop as the uint16_t pointer used in this function can point to an unalined address. Jira: ZEP-2012 Change-Id: Idfbfa8da4c8d4e10299c4ae4d6431b10466cc988 Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
This commit is contained in:
parent
0e3d582623
commit
8f97651d23
1 changed files with 2 additions and 2 deletions
|
@ -141,7 +141,7 @@ char *net_addr_ntop(sa_family_t family, const void *src,
|
||||||
uint8_t j;
|
uint8_t j;
|
||||||
|
|
||||||
for (j = i; j < 8; j++) {
|
for (j = i; j < 8; j++) {
|
||||||
if (w[j] != 0) {
|
if (UNALIGNED_GET(&w[j]) != 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ char *net_addr_ntop(sa_family_t family, const void *src,
|
||||||
needcolon = false;
|
needcolon = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
value = (uint32_t)sys_be16_to_cpu(w[i]);
|
value = (uint32_t)sys_be16_to_cpu(UNALIGNED_GET(&w[i]));
|
||||||
bh = value >> 8;
|
bh = value >> 8;
|
||||||
bl = value & 0xff;
|
bl = value & 0xff;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue