bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Uninitialized variable "path" in XGFontManager


From: Kim Shrier
Subject: Uninitialized variable "path" in XGFontManager
Date: Sun, 24 Jun 2001 17:12:19 -0500

I finally tracked down a problem I was having with running applications.

If I had not created a Library directory under the GNUstep directory in
my home directory, ie. ~/GNUstep/Library does not exist, then GNUstep
apps would segfault on startup.

I have tracked it down to the use of the path variable in
XGFontManager.m on line 90.  If the paths array has 0 entries, then
then path is not assigned a value.  This variable is then passed to
the NSFileManager which tries to get the cString value of the
uninitialized path variable, causing the seg fault.

I have included a patch which fixes the problem.  I made a guess
as to what the log message should be.

Kim
-- 
 Kim Shrier - principal, Shrier and Deihl - mailto:kim@tinker.com
Remote Unix Network Admin, Security, Internet Software Development
  Tinker Internet Services - Superior FreeBSD-based Web Hosting
                     http://www.tinker.com/
--- XGFontManager.m.orig        Mon Mar 26 17:17:30 2001
+++ XGFontManager.m     Sun Jun 24 16:51:04 2001
@@ -86,6 +86,11 @@
         {
           path = [paths objectAtIndex: 0];
         }
+      else
+       {
+         NSLog(@"No library directory available!");
+         return NO;
+       }
       mgr = [NSFileManager defaultManager];
       if ([mgr fileExistsAtPath: path isDirectory: &flag] == NO || flag == NO)
        {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]