blob: adc833f345b121b8116583b5916958370679c32b (
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
|
$NetBSD: patch-aa,v 1.2 2007/08/20 23:18:07 joerg Exp $
--- xmessage.c.orig 2007-04-24 21:55:34.000000000 +0200
+++ xmessage.c
@@ -34,6 +34,7 @@ from the X Consortium.
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Shell.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
@@ -170,6 +171,11 @@ detab (char **messagep, int *lengthp)
n++;
/* length increases by at most seven extra spaces for each tab */
+ if (n >= (INT_MAX - *lengthp - 1) / 7) {
+ fprintf (stderr, "%s: integer overflow, terminating\n", ProgramName);
+ exit (1);
+ }
+
psize = *lengthp + n*7 + 1;
p = XtMalloc (psize);
|