summaryrefslogtreecommitdiff
path: root/print/cups/patches/patch-bc
blob: 5a5e0c7f15c01686b2c6620af2dcad46302a26c7 (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
27
28
29
30
31
$NetBSD: patch-bc,v 1.4 2010/06/16 21:15:18 sbd Exp $

Incorporate part of str3516.patch from
http://www.cups.org/str.php?L3516
"Missing malloc checks in texttops"

--- filter/texttops.c.orig	2008-11-06 16:42:18.000000000 +0000
+++ filter/texttops.c
@@ -181,8 +181,20 @@ WriteProlog(const char *title,		/* I - T
     exit(1);
   }
 
-  Page    = calloc(sizeof(lchar_t *), SizeLines);
-  Page[0] = calloc(sizeof(lchar_t), SizeColumns * SizeLines);
+  if ((Page = calloc(sizeof(lchar_t *), SizeLines)) == NULL)
+  {
+    _cupsLangPrintf(stderr, _("ERROR: Unable to print %dx%d text page!\n"),
+		    SizeColumns, SizeLines);
+    exit(1);
+  }
+
+  if ((Page[0] = calloc(sizeof(lchar_t), SizeColumns * SizeLines)) == NULL)
+  {
+    _cupsLangPrintf(stderr, _("ERROR: Unable to print %dx%d text page!\n"),
+		    SizeColumns, SizeLines);
+    exit(1);
+  }
+
   for (i = 1; i < SizeLines; i ++)
     Page[i] = Page[0] + i * SizeColumns;