summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/ecvt.c
diff options
context:
space:
mode:
authormartynas <martynas@openbsd.org>2009-10-16 12:15:03 +0000
committermartynas <martynas@openbsd.org>2009-10-16 12:15:03 +0000
commit384cfdc17f187fdfda3c3de624a12d09397918b3 (patch)
tree829022ef0c09ec5d77cf4e4b653040c3a44dd31e /lib/libc/stdlib/ecvt.c
parentsort flags in synopsis, usage, and description. (diff)
downloadwireguard-openbsd-384cfdc17f187fdfda3c3de624a12d09397918b3.tar.xz
wireguard-openbsd-384cfdc17f187fdfda3c3de624a12d09397918b3.zip
teach gdtoa & its subroutines that malloc can fail; in which case
ecvt, fcvt, gcvt, *printf, strtof, strtod, strtold act per ieee 1003.1. after these massive changes, remove unused files which would not work now. reported by Maksymilian Arciemowicz; ok theo
Diffstat (limited to 'lib/libc/stdlib/ecvt.c')
-rw-r--r--lib/libc/stdlib/ecvt.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/stdlib/ecvt.c b/lib/libc/stdlib/ecvt.c
index 719370a8f37..03ff9189677 100644
--- a/lib/libc/stdlib/ecvt.c
+++ b/lib/libc/stdlib/ecvt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ecvt.c,v 1.6 2006/10/29 18:45:56 deraadt Exp $ */
+/* $OpenBSD: ecvt.c,v 1.7 2009/10/16 12:15:03 martynas Exp $ */
/*
* Copyright (c) 2002, 2006 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -62,6 +62,8 @@ __cvt(double value, int ndigit, int *decpt, int *sign, int fmode, int pad)
*rve = '\0';
} else {
p = __dtoa(value, fmode + 2, ndigit, decpt, sign, &rve);
+ if (p == NULL)
+ return (NULL);
if (*decpt == 9999) {
/* Infinity or Nan, convert to inf or nan like printf */
*decpt = 0;