ray@intvax.UUCP (Larry P. Ray) (03/17/89)
This is a copy of a bug report submitted regarding an xedit bug which definitely affects Sun 4s running SunOS4.0, and may affect other systems as well. X Window System Bug Report xbugs@expo.lcs.mit.edu FROM: lpray@sandia.gov VERSION: R3 CLIENT MACHINE and OPERATING SYSTEM: Sun 4/260 running SunOS 4.0 (probably any SunOS 4.0) DISPLAY: Sun CG2 (probably any) WINDOW MANAGER: uwm (probably any) AREA: xedit SYNOPSIS: xedit crashes immediately in the above configuration, before the outline box is displayed. DESCRIPTION: The main() function in xedit.c depends on the array args[3] being initialized to zero by the operating system. Although args[0] and args[1] are initialized by the xedit code, args[2] is not. If args[2].name is not equal to 0, it will be treated as a pointer to a string containing the name of an argument. Although many operating systems clear automatic variables, K&R, p. 198, says garbage will be present if not initialized. SunOS 4.0 does not clear these variables. REPEAT BY: Run xedit on above configuration. SAMPLE FIX: *** xedit.orig Mon Jan 30 17:33:43 1989 --- xedit.c Fri Feb 10 19:20:11 1989 *************** *** 180,185 **** --- 180,186 ---- toplevel = XtInitialize( "xedit", "Xedit", NULL, 0, &argc, argv); XtSetArg(args[0], XtNwidth, &width); XtSetArg(args[1], XtNheight, &height); + args[2].name = 0; /* not auto cleared */ XtGetValues(toplevel, args, XtNumber(args)); if (width == 0) width = DEFWIDTH; if (height == 0) height = DEFHEIGHT;