reassign 537718 libgksu 2.0.13
tags +patch
retitle libgksu: Unguarded variable causes assert

Hello,

I've encountered this bug too.
Here is a patch that fixes the problem. In my case the fprintf(stderr,
"%s", child_stderr) would attempt to print the NULL pointer.

It turns out that the bug is not in gksu, but in libgksu.

With kind regards,
Roland Clobus

PS: As a result of this patch, the gksudo will silently fail. But that's
already reported in other bug reports. (The failure to run is correctly
logged in /var/log/auth.log though)

Description: Unguarded variable
Author: Roland Clobus <rclo...@rclobus.nl>
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=537718
 The variable child_stderr was not always filled, so extra guards for the NULL
 pointer were required.
--- libgksu-2.0.13~pre1.orig/libgksu/libgksu.c
+++ libgksu-2.0.13~pre1/libgksu/libgksu.c
@@ -2951,7 +2951,8 @@ gksu_sudo_fuller (GksuContext *context,
 
       if (WEXITSTATUS(status))
 	{
-          if (g_str_has_prefix(child_stderr, "Sorry, user "))
+          if (child_stderr != NULL && 
+              g_str_has_prefix(child_stderr, "Sorry, user "))
             {
               g_set_error (error, gksu_quark, GKSU_ERROR_NOT_ALLOWED,
                            _("The underlying authorization mechanism (sudo) "
@@ -2979,7 +2980,8 @@ gksu_sudo_fuller (GksuContext *context,
 	}
     }
 
-  fprintf(stderr, "%s", child_stderr);
+  if (child_stderr != NULL)
+    fprintf(stderr, "%s", child_stderr);
   g_free(child_stderr);
 
   /* if error is set we have found an error condition */

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to