-/* Copyright (c) 1997 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
static u_long
searchttl (char *str)
{
- char buf[1024];
+ char buf[strlen (str) + 1];
char *cptr, *dptr;
u_long time;
int i;
return DEFAULT_TTL;
strncpy (buf, dptr, i);
+ buf[i] = '\0';
time = 0;
dptr = buf;
static u_long
searchaccess (char *str, u_long access)
{
- char buf[NIS_MAXNAMELEN];
+ char buf[strlen (str) + 1];
char *cptr;
u_long result = access;
int i;
return 0;
strncpy (buf, cptr, i);
+ buf[i] = '\0';
n = o = g = w = 0;
cptr = buf;
+ if (*cptr == ',') /* Fix for stupid Solaris scripts */
+ ++cptr;
while (*cptr != '\0')
{
switch (*cptr)
o = g = w = 1;
break;
case '-':
- cptr++; /* Remove "=" from beginning */
+ cptr++; /* Remove "-" from beginning */
while (*cptr != '\0' && *cptr != ',')
{
switch (*cptr)
n = o = g = w = 0;
break;
case '+':
- cptr++; /* Remove "=" from beginning */
+ cptr++; /* Remove "+" from beginning */
while (*cptr != '\0' && *cptr != ',')
{
switch (*cptr)
default:
return result = ULONG_MAX;
}
- cptr++;
+ if (*cptr != '\0')
+ cptr++;
}
return result;
nis_name
__nis_default_owner (char *defaults)
{
- char default_owner[NIS_MAXNAMELEN];
+ char default_owner[NIS_MAXNAMELEN + 1];
char *cptr, *dptr;
strcpy (default_owner, nis_local_principal ());
if (dptr != NULL)
{
char *p = searchowner (defaults);
- strcpy (default_owner, p);
+ if (strlen (p) <= NIS_MAXNAMELEN)
+ strcpy (default_owner, p);
free (p);
}
}
if (dptr != NULL)
{
char *p = searchowner (cptr);
- strcpy (default_owner, p);
+ if (strlen (p) <= NIS_MAXNAMELEN)
+ strcpy (default_owner, p);
free (p);
}
}
nis_name
__nis_default_group (char *defaults)
{
- char default_group[NIS_MAXNAMELEN];
+ char default_group[NIS_MAXNAMELEN + 1];
char *cptr, *dptr;
strcpy (default_group, nis_local_group ());
if (dptr != NULL)
{
char *p = searchgroup (defaults);
- strcpy (default_group, p);
+
+ if (strlen (p) <= NIS_MAXNAMELEN)
+ strcpy (default_group, p);
free (p);
}
}
if (dptr != NULL)
{
char *p = searchgroup (cptr);
- strcpy (default_group, p);
+
+ if (strlen (p) <= NIS_MAXNAMELEN)
+ strcpy (default_group, p);
free (p);
}
}
--- /dev/null
+/* Set floating-point environment exception handling.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+#include <math.h>
+#include <fpu_control.h>
+
+void
+fesetexceptflag (const fexcept_t *flagp, int excepts)
+{
+ fexcept_t temp;
+
+ /* Get the current environment. */
+ _FPU_GETCW(temp);
+
+ /* Set the desired exception mask. */
+ temp &= ~((excepts & FE_ALL_EXCEPT) << FE_EXCEPT_SHIFT);
+ temp |= (*flagp & excepts & FE_ALL_EXCEPT) << FE_EXCEPT_SHIFT;
+
+ /* Save state back to the FPU. */
+ _FPU_SETCW(temp);
+}