From 51702635af8445431054291c86aaace7c30b0970 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 7 May 1997 15:31:21 +0000 Subject: Update. * locale/categories.def: Change type of _NL_CTYPE_CLASS_NAMES and _NL_CTYPE_MAP_NAMES field to stringlist. Change name of _NL_CTYPE_CODESET_NAME to "charmap". * locale/localeinfo.h (enum value_type): Add stringlist. * locale/programs/locale.c (show_info): Handle stringlist. * locale/programs/charmap.c (charmap_read): If charmap file is not using the given name try to find it by looking through all available charmap files and compare the code set name. * locale/programs/locale.c (write_charmaps): Also print names of charset in fields in the files. * elf/ldd.bash.in: Correct translatable strings. * posix/TESTS: Add some more tests for character class matching. * posix/regex.c: Merge with GNU awk version. (regex_compile): Use ISO C/amend 1 functions for character class handling. * posix/regex.h: Merge with GNU awk version. * posix/getopt.c: Declare as master copies. * posix/getopt1.c: Likewise. * posix/getopt.h: Likewise. * sysdeps/unix/sysv/linux/sys/mount.h: Add definitions for option value to mount functions. Patch by a sun . * stdio-common/bug4.c (main): Use /tmp/bug4.test for concurrency with other tests. * sunrpc/svc_run.c (svc_exit): New, defined. (svc_run): Test for svc_stop variable. * sysdeps/m68k/s_cexp.c: Rewritten. * sysdeps/m68k/s_cexpf.c: Likewise. * sysdeps/m68k/s_cexpl.c: Likewise. --- nis/nis_subr.c | 44 ++++++++++---------------------------------- 1 file changed, 10 insertions(+), 34 deletions(-) (limited to 'nis/nis_subr.c') diff --git a/nis/nis_subr.c b/nis/nis_subr.c index 479e11d175..780c27f7b5 100644 --- a/nis/nis_subr.c +++ b/nis/nis_subr.c @@ -46,8 +46,16 @@ nis_leaf_of_r (const_nis_name name, char *buffer, size_t buflen) return NULL; } - if (i > 1) - strncpy (buffer, name, i - 1); + if (i > 0) + { + if ((size_t)i >= buflen) + { + errno = ERANGE; + return NULL; + } + strncpy (buffer, name, i); + buffer[i] = 0; + } return buffer; } @@ -89,38 +97,6 @@ nis_name_of_r (const_nis_name name, char *buffer, size_t buflen) return buffer; } -nis_name -nis_domain_of (const_nis_name name) -{ - static char result[NIS_MAXNAMELEN + 1]; - - return nis_domain_of_r (name, result, NIS_MAXNAMELEN); -} - -nis_name -nis_domain_of_r (const_nis_name name, char *buffer, size_t buflen) -{ - char *cptr; - size_t cptr_len; - - cptr = strchr (name, '.'); /* XXX What happens if the NIS name - does not contain a `.'? */ - ++cptr; - cptr_len = strlen (cptr); - - if (cptr_len == 0) - strcpy (buffer, "."); - else if (cptr_len >= buflen) - { - errno = ERANGE; - return NULL; - } - else - memcpy (buffer, cptr, cptr_len + 1); - - return buffer; -} - static int count_dots (const_nis_name str) { -- cgit v1.2.3