$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 #include #include +#include #include #include @@ -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);