about summary refs log tree commit diff
path: root/localedata/tst-fmon.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2016-04-22 17:11:09 -0400
committerMike Frysinger <vapier@gentoo.org>2016-04-23 16:14:01 -0400
commitb2cae5d3f5f58e26fe3ceb9c9c2a4018e25785e6 (patch)
treec521f1356dd7d9f6577749d1e8c8492cfbbec068 /localedata/tst-fmon.c
parent4964bb4591b16b485eac3c5ecc8a383b528ea1a6 (diff)
downloadglibc-b2cae5d3f5f58e26fe3ceb9c9c2a4018e25785e6.tar.gz
glibc-b2cae5d3f5f58e26fe3ceb9c9c2a4018e25785e6.tar.xz
glibc-b2cae5d3f5f58e26fe3ceb9c9c2a4018e25785e6.zip
tst-fmon/tst-numeric: switch malloc to static stack space [BZ #19671]
The current test code doesn't check the return value of malloc.
This should rarely (if ever) cause a problem, but rather than add
some return value checks, just statically allocate the buffer on
the stack.  This will never fail (or if it does, we've got much
bigger problems that don't matter to the test).
Diffstat (limited to 'localedata/tst-fmon.c')
-rw-r--r--localedata/tst-fmon.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/localedata/tst-fmon.c b/localedata/tst-fmon.c
index 995cf9056c..62cd7dbfd5 100644
--- a/localedata/tst-fmon.c
+++ b/localedata/tst-fmon.c
@@ -40,7 +40,7 @@
 int
 main (int argc, char *argv[])
 {
-  char *s = malloc (201);
+  char s[200];
 
   if (setlocale (LC_MONETARY, argv[1]) == NULL)
     {
@@ -48,7 +48,7 @@ main (int argc, char *argv[])
       exit (EXIT_SETLOCALE);
     }
 
-  if (strfmon (s, 200, argv[2], (double) atof (argv[3])) == -1)
+  if (strfmon (s, sizeof (s), argv[2], (double) atof (argv[3])) == -1)
     {
       perror ("strfmon");
       exit (EXIT_STRFMON);