aboutsummaryrefslogtreecommitdiff
path: root/libXmu/src/StrToCurs.c
diff options
context:
space:
mode:
Diffstat (limited to 'libXmu/src/StrToCurs.c')
-rw-r--r--libXmu/src/StrToCurs.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/libXmu/src/StrToCurs.c b/libXmu/src/StrToCurs.c
index 7f13c0d4e..4d72f80cb 100644
--- a/libXmu/src/StrToCurs.c
+++ b/libXmu/src/StrToCurs.c
@@ -1,5 +1,3 @@
-/* $Xorg: StrToCurs.c,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */
-
/*
Copyright 1987, 1988, 1998 The Open Group
@@ -50,8 +48,6 @@ SOFTWARE.
******************************************************************/
-/* $XFree86: xc/lib/Xmu/StrToCurs.c,v 1.11 2002/09/19 13:21:58 tsi Exp $ */
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -159,25 +155,29 @@ XmuCvtStringToCursor(XrmValuePtr args, Cardinal *num_args,
if (0 == strncmp(FONTSPECIFIER, name, strlen(FONTSPECIFIER))) {
char source_name[PATH_MAX], mask_name[PATH_MAX];
- int source_char, mask_char, fields;
+ int source_char, mask_char, fields = 0;
Font source_font, mask_font;
XrmValue fromString, toFont;
XrmValue cvtArg;
Boolean success;
Display *dpy = DisplayOfScreen(screen);
- char *strspec = NULL;
+ char *strspec = NULL;
+ int strspeclen;
#ifdef XMU_KLUDGE
Cardinal num;
#endif
- strspec = XtMalloc(strlen("FONT %s %d %s %d") + 21);
- sprintf(strspec, "FONT %%%lds %%d %%%lds %%d",
- (unsigned long)sizeof(source_name) - 1,
- (unsigned long)sizeof(mask_name) - 1);
- fields = sscanf(name, strspec,
- source_name, &source_char,
- mask_name, &mask_char);
- XtFree(strspec);
+ strspeclen = strlen("FONT %s %d %s %d") + 21;
+ strspec = XtMalloc(strspeclen);
+ if (strspec != NULL) {
+ snprintf(strspec, strspeclen, "FONT %%%lds %%d %%%lds %%d",
+ (unsigned long)sizeof(source_name) - 1,
+ (unsigned long)sizeof(mask_name) - 1);
+ fields = sscanf(name, strspec,
+ source_name, &source_char,
+ mask_name, &mask_char);
+ XtFree(strspec);
+ }
if (fields < 2) {
XtStringConversionWarning(name, XtRCursor);
return;