gethnamaddr: Fix aliasing violations

Change-Id: I3d46d9a67f8e638f5ca5b26ec112c29d4350dea7
Signed-off-by: zwliew <zhaoweiliew@gmail.com>