summaryrefslogtreecommitdiff
path: root/lang/php5/patches/patch-main_spprintf.c
blob: 6c736abbcbb71ee10c11bb6bf0d2b7e0f0a6bee2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$NetBSD: patch-main_spprintf.c,v 1.1.2.2 2011/03/22 06:31:55 sbd Exp $

--- main/spprintf.c.orig	2010-01-03 09:23:27.000000000 +0000
+++ main/spprintf.c
@@ -282,10 +282,6 @@ static void xbuf_format_converter(smart_
 
 				/*
 				 * Check if a precision was specified
-				 *
-				 * XXX: an unreasonable amount of precision may be specified
-				 * resulting in overflow of num_buf. Currently we
-				 * ignore this possibility.
 				 */
 				if (*fmt == '.') {
 					adjust_precision = YES;
@@ -299,6 +295,10 @@ static void xbuf_format_converter(smart_
 							precision = 0;
 					} else
 						precision = 0;
+
+					if (precision > FORMAT_CONV_MAX_PRECISION) {
+						precision = FORMAT_CONV_MAX_PRECISION;
+					}
 				} else
 					adjust_precision = NO;
 			} else