Xaw3d/Xaw3d-1.5E-secure.patch

96 lines
3.2 KiB
Diff

From 2094de170afa65b057bca4a1e9d38ca7ae656265 Mon Sep 17 00:00:00 2001
From: Markus Steinborn <gnugv_maintainer@yahoo.de>
Date: Sat, 24 Apr 2010 17:02:15 +0200
Subject: [PATCH] Xaw3d-1.5E-secure.patch
---
xc/lib/Xaw3d/AsciiSrcP.h | 6 +++-
xc/lib/Xaw3d/Layout.c | 18 +++++++++--
xc/lib/Xaw3d/MenuButton.c | 15 +++++++--
xc/lib/Xaw3d/MultiSrcP.h | 6 +++-
xc/lib/Xaw3d/Simple.c | 18 ++++++++---
xc/lib/Xaw3d/SimpleMenu.c | 16 ++++++++--
xc/lib/Xaw3d/SmeBSB.c | 51 +++++++++++++++++++++-----------
xc/lib/Xaw3d/Text.c | 50 +++++++++++++++++++++++--------
xc/lib/Xaw3d/TextPop.c | 71 ++++++++++++++++++++++++++++++++++++++-------
xc/lib/Xaw3d/XawAlloc.h | 10 ++++++
xc/lib/Xaw3d/XawI18n.h | 2 +
xc/lib/Xaw3d/XawIm.c | 4 +-
12 files changed, 206 insertions(+), 61 deletions(-)
create mode 100644 xc/lib/Xaw3d/XawAlloc.h
diff --git libXaw3d-1.6.1/src/Layout.c libXaw3d-1.6.1/src/Layout.c
index 44d391a..dd4b253 100644
--- libXaw3d-1.6.1/src/Layout.c
+++ libXaw3d-1.6.1/src/Layout.c
@@ -39,6 +39,8 @@
# include <X11/Xaw3d/LayoutP.h>
#endif
+#include "XawAlloc.h"
+
#include <ctype.h>
#include <stdio.h>
@@ -595,10 +597,18 @@ Evaluate (l, box, expr, natural)
nexpr = LookupVariable (box, expr->u.variable);
if (!nexpr)
{
- char buf[256];
- (void) sprintf (buf, "Layout: undefined variable %s\n",
- XrmQuarkToString (expr->u.variable));
- XtError (buf);
+ char *pvar = XrmQuarkToString (expr->u.variable);
+ char *msg = "Layout: undefined variable ";
+ int len = strlen(msg) + strlen(pvar) + 2;
+ char *pbuf, buf[256];
+
+ pbuf = XtStackAlloc(len, buf);
+ if (pbuf != NULL)
+ {
+ sprintf(pbuf, "%s%s\n", msg, pvar);
+ XtError (buf);
+ XtStackFree(pbuf, buf);
+ }
return 0.0;
}
return Evaluate (l, box, nexpr, natural);
diff --git libXaw3d-1.6.1/src/XawI18n.h libXaw3d-1.6.1/src/XawI18n.h
index 1b0ee5d..b0176bf 100644
--- libXaw3d-1.6.1/src/XawI18n.h
+++ libXaw3d-1.6.1/src/XawI18n.h
@@ -29,11 +29,13 @@ in this Software without prior written authorization from the X Consortium.
#ifdef HAS_WCTYPE_H
#include <wctype.h>
+#ifndef NO_WIDEC_H
#include <widec.h>
#define wcslen(c) wslen(c)
#define wcscpy(d,s) wscpy(d,s)
#define wcsncpy(d,s,l) wsncpy(d,s,l)
#endif
+#endif
#ifdef HAS_WCHAR_H
#include <wchar.h>
diff --git libXaw3d-1.6.1/src/XawIm.c libXaw3d-1.6.1/src/XawIm.c
index 730c393..a5d0032 100644
--- libXaw3d-1.6.1/src/XawIm.c
+++ libXaw3d-1.6.1/src/XawIm.c
@@ -1644,10 +1644,10 @@ _XawImWcLookupString( inwidg, event, buffer_return, bytes_buffer,
if ((vw = SearchVendorShell(inwidg)) && (ve = GetExtPart(vw)) &&
ve->im.xim && (p = GetIcTableShared(inwidg, ve)) && p->xic) {
- return(XwcLookupString(p->xic, event, buffer_return, bytes_buffer,
+ return(XwcLookupString(p->xic, event, buffer_return, bytes_buffer/sizeof(wchar_t),
keysym_return, status_return));
}
- ret = XLookupString( event, tmp_buf, 64, keysym_return,
+ ret = XLookupString( event, tmp_buf, sizeof(tmp_buf), keysym_return,
(XComposeStatus*) status_return );
for ( i = 0, tmp_p = tmp_buf, buf_p = buffer_return; i < ret; i++ ) {
*buf_p++ = _Xaw_atowc(*tmp_p++);
--
1.6.1