From 616d91335a8be5fda715a34dac48bb067d77b523 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 7 Apr 2006 07:02:20 +0000 Subject: [PATCH] * elf/ldconfig.c (main): Use rawmemchr instead of strchr. * nis/nis_call.c (rec_dirsearch): Likewise. * nis/nis_local_names.c (nis_local_host): Likewise. (nis_local_directory): Likewise. * intl/explodename.c (_nl_explode_name): Likewise. * sysdeps/generic/unwind-dw2.c (execute_cfa_program): Don't handle DW_CFA_GNU_windiw_save if it obviously cannot work [Coverity CID 102]. * locale/programs/ld-address.c (address_finish): Fix conditions for error messages [Coverity CID 104]. --- ChangeLog | 12 ++++++++++++ elf/ldconfig.c | 2 +- intl/explodename.c | 4 ++-- locale/programs/ld-address.c | 10 +++++++--- nis/nis_call.c | 4 ++-- nis/nis_local_names.c | 6 +++--- sysdeps/generic/unwind-dw2.c | 8 ++++++-- 7 files changed, 33 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4e50c97615..4541ce76cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2006-04-06 Ulrich Drepper + * elf/ldconfig.c (main): Use rawmemchr instead of strchr. + * nis/nis_call.c (rec_dirsearch): Likewise. + * nis/nis_local_names.c (nis_local_host): Likewise. + (nis_local_directory): Likewise. + * intl/explodename.c (_nl_explode_name): Likewise. + + * sysdeps/generic/unwind-dw2.c (execute_cfa_program): Don't handle + DW_CFA_GNU_windiw_save if it obviously cannot work [Coverity CID 102]. + + * locale/programs/ld-address.c (address_finish): Fix conditions + for error messages [Coverity CID 104]. + * libio/fmemopen.c (fmemopen): Free stream memory in case of invalid length [Coverity CID 106]. diff --git a/elf/ldconfig.c b/elf/ldconfig.c index 359fbdbf0e..5b9a5b1744 100644 --- a/elf/ldconfig.c +++ b/elf/ldconfig.c @@ -1194,7 +1194,7 @@ main (int argc, char **argv) if (opt_chroot) { /* Normalize the path a bit, we might need it for printing later. */ - char *endp = strchr (opt_chroot, '\0'); + char *endp = rawmemchr (opt_chroot, '\0'); while (endp > opt_chroot && endp[-1] == '/') --endp; *endp = '\0'; diff --git a/intl/explodename.c b/intl/explodename.c index f7bcfa5ff6..8e326ead53 100644 --- a/intl/explodename.c +++ b/intl/explodename.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1995-2002, 2003, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1995. @@ -78,7 +78,7 @@ _nl_explode_name (name, language, modifier, territory, codeset, if (*language == cp) /* This does not make sense: language has to be specified. Use this entry as it is without exploding. Perhaps it is an alias. */ - cp = strchr (*language, '\0'); + cp = __rawmemchr (*language, '\0'); else if (cp[0] != '@') { if (cp[0] == '_') diff --git a/locale/programs/ld-address.c b/locale/programs/ld-address.c index 4d649b0456..83cd9fa17b 100644 --- a/locale/programs/ld-address.c +++ b/locale/programs/ld-address.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2002, 2005 Free Software Foundation, Inc. +/* Copyright (C) 1998-2002, 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. @@ -222,14 +222,18 @@ No definition for %s category found"), "LC_ADDRESS")); if (address->lang_ab == NULL) { - if (iso639[cnt].ab[0] != '\0' && verbose && ! nothing) + if ((cnt == sizeof (iso639) / sizeof (iso639[0]) + || iso639[cnt].ab[0] != '\0') + && verbose && ! nothing) WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"), "LC_ADDRESS", "lang_ab")); address->lang_ab = ""; } else if (address->lang_ab[0] == '\0') { - if (iso639[cnt].ab[0] != '\0' && verbose) + if ((cnt == sizeof (iso639) / sizeof (iso639[0]) + || iso639[cnt].ab[0] != '\0') + && verbose) WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"), "LC_ADDRESS", "lang_ab")); } diff --git a/nis/nis_call.c b/nis/nis_call.c index 5b432b7981..32d29ae99f 100644 --- a/nis/nis_call.c +++ b/nis/nis_call.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2001, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,2001,2004,2005,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1997. @@ -428,7 +428,7 @@ rec_dirsearch (const_nis_name name, directory_obj *dir, nis_error *status) return dir; } - cp = strchr (leaf, '\0'); + cp = rawmemchr (leaf, '\0'); *cp++ = '.'; strcpy (cp, domain); diff --git a/nis/nis_local_names.c b/nis/nis_local_names.c index 30fd208b75..e9aea12a86 100644 --- a/nis/nis_local_names.c +++ b/nis/nis_local_names.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997, 1998, 2004 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1998, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1997. @@ -63,7 +63,7 @@ nis_local_directory (void) __nisdomainname[0] = '\0'; else { - char *cp = strchr (__nisdomainname, '\0'); + char *cp = rawmemchr (__nisdomainname, '\0'); /* Missing trailing dot? */ if (cp[-1] != '.') @@ -154,7 +154,7 @@ nis_local_host (void) __nishostname[0] = '\0'; else { - char *cp = strchr (__nishostname, '\0'); + char *cp = rawmemchr (__nishostname, '\0'); int len = cp - __nishostname; /* Hostname already fully qualified? */ diff --git a/sysdeps/generic/unwind-dw2.c b/sysdeps/generic/unwind-dw2.c index 301b53176e..3fc0d931e9 100644 --- a/sysdeps/generic/unwind-dw2.c +++ b/sysdeps/generic/unwind-dw2.c @@ -1,5 +1,5 @@ /* DWARF2 exception handling and frame unwind runtime interface routines. - Copyright (C) 1997,1998,1999,2000,2001,2002,2003,2005 + Copyright (C) 1997,1998,1999,2000,2001,2002,2003,2005,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -897,12 +897,16 @@ execute_cfa_program (const unsigned char *insn_ptr, break; case DW_CFA_GNU_window_save: - /* ??? Hardcoded for SPARC register window configuration. */ + /* ??? Hardcoded for SPARC register window configuration. + At least do not do anything for archs which explicitly + define a lower register number. */ +#if DWARF_FRAME_REGISTERS < 32 for (reg = 16; reg < 32; ++reg) { fs->regs.reg[reg].how = REG_SAVED_OFFSET; fs->regs.reg[reg].loc.offset = (reg - 16) * sizeof (void *); } +#endif break; case DW_CFA_GNU_args_size: