summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-05-05 13:37:35 +0000
committerUlrich Drepper <drepper@redhat.com>2006-05-05 13:37:35 +0000
commitfff04b32afcf55edd678f7635a70f8918c4a0bd9 (patch)
tree6e1827fe0ef244487cc8757014639a4b8834da2a
parentf2d5cf5005abf48aeaf4e7e8093aa49f32c76756 (diff)
2006-05-05 Jakub Jelinek <jakub@redhat.com> [BZ #2509] * stdio-common/tst-printf.sh: Adjust for tst-printf.c change even on 32-bit arches. 2006-05-05 Ulrich Drepper <drepper@redhat.com> * locale/programs/ld-address.c (address_finish): Fix one more place where the iso639 array might be access beyond the limits.
-rw-r--r--ChangeLog11
-rw-r--r--locale/programs/ld-address.c3
-rw-r--r--nis/nis_table.c67
-rw-r--r--stdio-common/tst-printf.sh8
4 files changed, 55 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index fc3bfaf1ef..8c427ac75c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2006-05-05 Jakub Jelinek <jakub@redhat.com>
+
+ [BZ #2509]
+ * stdio-common/tst-printf.sh: Adjust for tst-printf.c change even
+ on 32-bit arches.
+
+2006-05-05 Ulrich Drepper <drepper@redhat.com>
+
+ * locale/programs/ld-address.c (address_finish): Fix one more
+ place where the iso639 array might be access beyond the limits.
+
2006-05-04 Ulrich Drepper <drepper@redhat.com>
* nis/nis_table.c (nis_list): Avoid clearing res twice before
diff --git a/locale/programs/ld-address.c b/locale/programs/ld-address.c
index 83cd9fa17b..dac8551071 100644
--- a/locale/programs/ld-address.c
+++ b/locale/programs/ld-address.c
@@ -237,7 +237,8 @@ No definition for %s category found"), "LC_ADDRESS"));
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"),
"LC_ADDRESS", "lang_ab"));
}
- else if (iso639[cnt].ab[0] == '\0')
+ else if (cnt < sizeof (iso639) / sizeof (iso639[0])
+ && iso639[cnt].ab[0] == '\0')
{
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be defined"),
"LC_ADDRESS", "lang_ab"));
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 49a630312a..eddba67dda 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -25,7 +25,7 @@
static struct ib_request *
-__create_ib_request (const_nis_name name, unsigned int flags)
+create_ib_request (const_nis_name name, unsigned int flags)
{
struct ib_request *ibreq = calloc (1, sizeof (struct ib_request));
nis_attr *search_val = NULL;
@@ -91,13 +91,13 @@ __create_ib_request (const_nis_name name, unsigned int flags)
if (cptr != NULL)
*cptr++ = '\0';
- if (!val)
+ if (__builtin_expect (val == NULL, 0))
{
nis_free_request (ibreq);
return NULL;
}
*val++ = '\0';
- if ((search_len + 1) >= size)
+ if (search_len + 1 >= size)
{
size += 1;
nis_attr *newp = realloc (search_val, size * sizeof (nis_attr));
@@ -106,7 +106,7 @@ __create_ib_request (const_nis_name name, unsigned int flags)
search_val = newp;
}
search_val[search_len].zattr_ndx = strdup (key);
- if ((search_val[search_len].zattr_ndx) == NULL)
+ if (search_val[search_len].zattr_ndx == NULL)
goto free_null;
search_val[search_len].zattr_val.zattr_val_len = strlen (val) + 1;
@@ -180,23 +180,23 @@ nis_list (const_nis_name name, unsigned int flags,
char *tableptr;
char *tablepath = NULL;
int first_try = 0; /* Do we try the old binding at first ? */
- int errcode;
if (res == NULL)
return NULL;
if (name == NULL)
{
- errcode = NIS_BADNAME;
+ status = NIS_BADNAME;
err_out:
memset (res, '\0', sizeof (nis_result));
- NIS_RES_STATUS (res) = NIS_BADNAME;
+ NIS_RES_STATUS (res) = status;
return res;
}
- if ((ibreq = __create_ib_request (name, flags)) == NULL)
+ ibreq = create_ib_request (name, flags);
+ if (ibreq == NULL)
{
- errcode = NIS_BADNAME;
+ status = NIS_BADNAME;
goto err_out;
}
@@ -209,7 +209,7 @@ nis_list (const_nis_name name, unsigned int flags,
if (names == NULL)
{
nis_free_request (ibreq);
- errcode = NIS_BADNAME;
+ status = NIS_BADNAME;
goto err_out;
}
ibreq->ibr_name = strdup (names[name_nr]);
@@ -217,7 +217,7 @@ nis_list (const_nis_name name, unsigned int flags,
{
nis_freenames (names);
nis_free_request (ibreq);
- errcode = NIS_NOMEMORY;
+ status = NIS_NOMEMORY;
goto err_out;
}
}
@@ -245,14 +245,14 @@ nis_list (const_nis_name name, unsigned int flags,
status = __nisbind_create (&bptr, dir->do_servers.do_servers_val,
dir->do_servers.do_servers_len, flags);
- if (status != NIS_SUCCESS)
+ if (__builtin_expect (status != NIS_SUCCESS, 0))
{
NIS_RES_STATUS (res) = status;
goto fail2;
}
while (__nisbind_connect (&bptr) != NIS_SUCCESS)
- if (__nisbind_next (&bptr) != NIS_SUCCESS)
+ if (__builtin_expect (__nisbind_next (&bptr) != NIS_SUCCESS, 0))
{
NIS_RES_STATUS (res) = NIS_NAMEUNREACHABLE;
goto fail;
@@ -271,7 +271,7 @@ nis_list (const_nis_name name, unsigned int flags,
(xdrproc_t) _xdr_nis_result,
(caddr_t) res, RPCTIMEOUT);
- if (clnt_status != RPC_SUCCESS)
+ if (__builtin_expect (clnt_status != RPC_SUCCESS, 0))
NIS_RES_STATUS (res) = NIS_RPCERROR;
else
switch (NIS_RES_STATUS (res))
@@ -285,7 +285,7 @@ nis_list (const_nis_name name, unsigned int flags,
free (ibreq->ibr_name);
ibreq->ibr_name = NULL;
/* If we hit the link limit, bail. */
- if (count_links > NIS_MAXLINKS)
+ if (__builtin_expect (count_links > NIS_MAXLINKS, 0))
{
NIS_RES_STATUS (res) = NIS_LINKNAMEERROR;
++done;
@@ -463,7 +463,7 @@ nis_list (const_nis_name name, unsigned int flags,
/* Try the next domainname if we don't follow a link. */
free (ibreq->ibr_name);
ibreq->ibr_name = NULL;
- if (count_links)
+ if (__builtin_expect (count_links, 0))
{
NIS_RES_STATUS (res) = NIS_LINKNAMEERROR;
++done;
@@ -524,11 +524,7 @@ nis_add_entry (const_nis_name name, const nis_object *obj2, unsigned int flags)
return res;
}
- size_t namelen = strlen (name);
- char buf1[namelen + 20];
- char buf4[namelen + 20];
-
- ib_request *ibreq = __create_ib_request (name, flags);
+ ib_request *ibreq = create_ib_request (name, flags);
if (ibreq == NULL)
{
NIS_RES_STATUS (res) = NIS_BADNAME;
@@ -538,6 +534,10 @@ nis_add_entry (const_nis_name name, const nis_object *obj2, unsigned int flags)
nis_object obj;
memcpy (&obj, obj2, sizeof (nis_object));
+ size_t namelen = strlen (name);
+ char buf1[namelen + 20];
+ char buf4[namelen + 20];
+
if (obj.zo_name == NULL || strlen (obj.zo_name) == 0)
obj.zo_name = nis_leaf_of_r (name, buf1, sizeof (buf1));
@@ -563,7 +563,7 @@ nis_add_entry (const_nis_name name, const nis_object *obj2, unsigned int flags)
(caddr_t) ibreq,
(xdrproc_t) _xdr_nis_result,
(caddr_t) res, 0, NULL);
- if (status != NIS_SUCCESS)
+ if (__builtin_expect (status != NIS_SUCCESS, 0))
NIS_RES_STATUS (res) = status;
nis_free_request (ibreq);
@@ -587,7 +587,8 @@ nis_modify_entry (const_nis_name name, const nis_object *obj2,
if (res == NULL)
return NULL;
- if (( ibreq =__create_ib_request (name, flags)) == NULL)
+ ibreq = create_ib_request (name, flags);
+ if (ibreq == NULL)
{
NIS_RES_STATUS (res) = NIS_BADNAME;
return res;
@@ -615,10 +616,11 @@ nis_modify_entry (const_nis_name name, const nis_object *obj2,
}
ibreq->ibr_obj.ibr_obj_len = 1;
- if ((status = __do_niscall (ibreq->ibr_name, NIS_IBMODIFY,
- (xdrproc_t) _xdr_ib_request,
- (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
- (caddr_t) res, 0, NULL)) != NIS_SUCCESS)
+ status = __do_niscall (ibreq->ibr_name, NIS_IBMODIFY,
+ (xdrproc_t) _xdr_ib_request,
+ (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
+ (caddr_t) res, 0, NULL);
+ if (__builtin_expect (status != NIS_SUCCESS, 0))
NIS_RES_STATUS (res) = status;
nis_free_request (ibreq);
@@ -644,7 +646,8 @@ nis_remove_entry (const_nis_name name, const nis_object *obj,
return res;
}
- if ((ibreq =__create_ib_request (name, flags)) == NULL)
+ ibreq = create_ib_request (name, flags);
+ if (ibreq == NULL)
{
NIS_RES_STATUS (res) = NIS_BADNAME;
return res;
@@ -690,7 +693,7 @@ nis_first_entry (const_nis_name name)
return res;
}
- ibreq = __create_ib_request (name, 0);
+ ibreq = create_ib_request (name, 0);
if (ibreq == NULL)
{
NIS_RES_STATUS (res) = NIS_BADNAME;
@@ -702,7 +705,7 @@ nis_first_entry (const_nis_name name)
(caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
(caddr_t) res, 0, NULL);
- if (status != NIS_SUCCESS)
+ if (__builtin_expect (status != NIS_SUCCESS, 0))
NIS_RES_STATUS (res) = status;
nis_free_request (ibreq);
@@ -727,7 +730,7 @@ nis_next_entry (const_nis_name name, const netobj *cookie)
return res;
}
- ibreq = __create_ib_request (name, 0);
+ ibreq = create_ib_request (name, 0);
if (ibreq == NULL)
{
NIS_RES_STATUS (res) = NIS_BADNAME;
@@ -745,7 +748,7 @@ nis_next_entry (const_nis_name name, const netobj *cookie)
(caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
(caddr_t) res, 0, NULL);
- if (status != NIS_SUCCESS)
+ if (__builtin_expect (status != NIS_SUCCESS, 0))
NIS_RES_STATUS (res) = status;
if (cookie != NULL)
diff --git a/stdio-common/tst-printf.sh b/stdio-common/tst-printf.sh
index 04d04b20b8..f3091d2f96 100644
--- a/stdio-common/tst-printf.sh
+++ b/stdio-common/tst-printf.sh
@@ -1,6 +1,6 @@
#! /bin/sh
# Testing of printf.
-# Copyright (C) 2000, 2002 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2002, 2006 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
#
@@ -136,6 +136,12 @@ Test ok.
sprintf (buf, "%07Lo", 040000000000ll) = 40000000000
printf ("%hhu", 257) = 1
printf ("%hu", 65537) = 1
+printf ("%hhi", 257) = 1
+printf ("%hi", 65537) = 1
+printf ("%1$hhu", 257) = 1
+printf ("%1$hu", 65537) = 1
+printf ("%1$hhi", 257) = 1
+printf ("%1$hi", 65537) = 1
--- Should be no further output. ---
EOF
cmp - ${common_objpfx}stdio-common/tst-printf.out > /dev/null 2>&1 ||