I can only find one small error in your new patch:

If fgets can not read at least one character (because of EOF), it will return 
NULL.  Your
definition of read_gstring_from_stdin does not handle that case (it will 
segfault on the
call to strlen(readp), or possibly before because the call to strip is not safe 
either).

I simply added a NULL check, making the definition like so:

gboolean read_gstring_from_stdin(GString *s)
{
  gchar buffer[255];
  char *readp;
  do
  {
     readp = fgets(buffer, sizeof(buffer), stdin);
     if (readp == NULL)
       return FALSE;
     strip (buffer);
     g_string_append(s, buffer);
  } while (sizeof(buffer)-1 == strlen(readp));
  return TRUE;
}

and tested the resulting package with good results.  I can now feed 3000 
arguments to
the xauth list testcase without problems.

I'm not sure whether the return code "FALSE" actually makes sense in the above, 
but
as the return code isn't checked anyway...  :-)

-- 
Hardcoded buffer size in gksu-run-helper
https://bugs.launchpad.net/bugs/173757
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to