summaryrefslogtreecommitdiff
path: root/resolv
diff options
context:
space:
mode:
Diffstat (limited to 'resolv')
-rw-r--r--resolv/res_send.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 8f0a6018b6..ac5cc0b4fe 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -784,7 +784,7 @@ send_vc(res_state statp,
#else
int aligned_resplen
= ((resplen + __alignof__ (HEADER) - 1)
- & (__alignof__ (HEADER) - 1));
+ & ~(__alignof__ (HEADER) - 1));
*anssizp2 = orig_anssizp - aligned_resplen;
*ansp2 = *ansp + aligned_resplen;
#endif
@@ -1058,8 +1058,16 @@ send_dg(res_state statp,
/* No buffer allocated for the first
reply. We can try to use the rest
of the user-provided buffer. */
+#ifdef _STRING_ARCH_unaligned
*anssizp2 = orig_anssizp - resplen;
*ansp2 = *ansp + resplen;
+#else
+ int aligned_resplen
+ = ((resplen + __alignof__ (HEADER) - 1)
+ & ~(__alignof__ (HEADER) - 1));
+ *anssizp2 = orig_anssizp - aligned_resplen;
+ *ansp2 = *ansp + aligned_resplen;
+#endif
} else {
/* The first reply did not fit into the
user-provided buffer. Maybe the second