24 lines
655 B
Text
24 lines
655 B
Text
$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);
|
|
|