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



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to