Your message dated Sat, 18 Apr 2015 13:32:44 +0200
with message-id <[email protected]>
and subject line Re: mg segfaults when trying to open a file using ~ if 
getlogin returns null
has caused the Debian Bug report #658539,
regarding mg segfaults when trying to open a file using ~ if getlogin returns 
null
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
658539: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=658539
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: mg
Version: 20110905-1
Severity: normal

If I open a file starting with ~, not specifying the username, mg uses
getlogin to try to figure who I am. On my machine, getlogin is
returning NULL and mg doesn't test for this. 

I'm uncertain as to why getlogin is returning NULL -- because I have
no utmp or wtmp? Or because /proc/self/loginuid returns UINT32_MAX ?
-- but it's a permitted error signalling value.

Specifically, in fileio.c:adjustname,

        /* first handle tilde expansion */
        if (fn[0] == '~') {
[...]
                if (ulen == 0) /* ~/ or ~ */
                        (void)strlcpy(user, getlogin(), sizeof(user));

And then strlcpy dereferences the NULL pointer it was passed.

I'm not certain what the right solution is if we can't get the user's
name, but segfaulting is definitely right out. 

Thanks!
 - Robert Jacobs


-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-1-686-pae (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages mg depends on:
ii  libc6        2.13-26
ii  libncurses5  5.9-4

mg recommends no packages.

mg suggests no packages.

-- no debconf information



--- End Message ---
--- Begin Message ---
Version: 20150323-1

AFAICS the problem has been fixed by upstream:

        :
        if (ulen == 0) { /* ~/ or ~ */
                if ((un = getlogin()) != NULL)
                        (void)strlcpy(user, un, sizeof(user));
                else
                        user[0] = '\0';
        :

Regards
Harri

--- End Message ---

Reply via email to