summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-06-02 11:05:06 +0000
committerUlrich Drepper <drepper@redhat.com>1999-06-02 11:05:06 +0000
commit3810076f7552e9eb4c52b2a2c14c25374b462565 (patch)
tree76cac62060fae4f33d9de626e5a099041caefa01
parentea6710d38f9b7ab8a8d3d565d1cadd8c58d56f38 (diff)
downloadglibc-3810076f7552e9eb4c52b2a2c14c25374b462565.tar.gz
Update.
1999-06-02 David S. Miller <davem@redhat.com> * nscd/nscd_gethst_r.c (nscd_gethst_r): Align the h_addr_list pointers properly.
-rw-r--r--ChangeLog5
-rw-r--r--nscd/nscd_gethst_r.c18
2 files changed, 16 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 6379e3d3c5..5e615cd850 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+1999-06-02 David S. Miller <davem@redhat.com>
+
+ * nscd/nscd_gethst_r.c (nscd_gethst_r): Align the h_addr_list
+ pointers properly.
+
1999-06-02 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/i386/sigaction.c: Read kernel-features.h
diff --git a/nscd/nscd_gethst_r.c b/nscd/nscd_gethst_r.c
index 961f69538a..96d274b065 100644
--- a/nscd/nscd_gethst_r.c
+++ b/nscd/nscd_gethst_r.c
@@ -167,7 +167,8 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
struct iovec vec[4];
size_t *aliases_len;
char *cp = buffer;
- uintptr_t align;
+ uintptr_t align1;
+ uintptr_t align2;
size_t total_len;
ssize_t cnt;
char *ignore;
@@ -175,10 +176,13 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
/* A first check whether the buffer is sufficently large is possible. */
/* Now allocate the buffer the array for the group members. We must
- align the pointer. */
- align = ((__alignof__ (char *) - (cp - ((char *) 0)))
- & (__alignof__ (char *) - 1));
- if (buflen < (align + hst_resp.h_name_len
+ align the pointer and the base of the h_addr_list pointers. */
+ align1 = ((__alignof__ (char *) - (cp - ((char *) 0)))
+ & (__alignof__ (char *) - 1));
+ align2 = ((__alignof__ (char *) - ((cp + align1 + hst_resp.h_name_len)
+ - ((char *) 0)))
+ & (__alignof__ (char *) - 1));
+ if (buflen < (align1 + hst_resp.h_name_len + align2 +
+ ((hst_resp.h_aliases_cnt + hst_resp.h_addr_list_cnt + 2)
* sizeof (char *))
+ hst_resp.h_addr_list_cnt * (type == AF_INET
@@ -189,7 +193,7 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
__close (sock);
return -1;
}
- cp += align;
+ cp += align1;
/* Prepare the result as far as we can. */
resultbuf->h_aliases = (char **) cp;
@@ -198,7 +202,7 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
cp += (hst_resp.h_addr_list_cnt + 1) * sizeof (char *);
resultbuf->h_name = cp;
- cp += hst_resp.h_name_len;
+ cp += hst_resp.h_name_len + align2;
vec[0].iov_base = resultbuf->h_name;
vec[0].iov_len = hst_resp.h_name_len;