[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: $USERPROFILE for $HOME on W32
From: |
Eli Zaretskii |
Subject: |
Re: $USERPROFILE for $HOME on W32 |
Date: |
Thu, 25 Nov 2004 23:45:18 +0200 |
> From: Stefan <address@hidden>
> Date: Thu, 25 Nov 2004 12:45:48 -0500
> Cc: address@hidden, Jason Rumney <address@hidden>
>
> >> + /* Set dir and shell from environment variables. */
> >> + strcpy (the_passwd.pw_dir, getenv ("HOME"));
>
> > What if strlen (getenv ("HOME")) >= sizeof (the_passwd.pw_dir)?
>
> Well, tough!
> This code is not new: it's just moved from one place to another so it's not
> a new problem.
Can you (or someone else) look at the w32 system headers and see how
struct passwd is defined there? I looked at two implementations
(DJGPP and glibc on Debian GNU/Linux), and they both define pw_dir and
pw_shell as `char *'. So using strcpy here might mean a disaster, as
no memory could have been allocated for them; I'd use strdup instead.
- Re: $USERPROFILE for $HOME on W32, (continued)
- Re: $USERPROFILE for $HOME on W32, Stefan Monnier, 2004/11/22
- Re: $USERPROFILE for $HOME on W32, Stefan Monnier, 2004/11/25
- Re: $USERPROFILE for $HOME on W32, Jason Rumney, 2004/11/25
- Re: $USERPROFILE for $HOME on W32, Stefan, 2004/11/25
- Re: $USERPROFILE for $HOME on W32, Eli Zaretskii, 2004/11/25
- Re: $USERPROFILE for $HOME on W32, Jason Rumney, 2004/11/25
- Re: $USERPROFILE for $HOME on W32, Eli Zaretskii, 2004/11/26
- Re: $USERPROFILE for $HOME on W32, Andreas Schwab, 2004/11/25
- Re: $USERPROFILE for $HOME on W32, Stefan, 2004/11/25
- Re: $USERPROFILE for $HOME on W32, Andreas Schwab, 2004/11/25
- Re: $USERPROFILE for $HOME on W32,
Eli Zaretskii <=
- Re: $USERPROFILE for $HOME on W32, Eli Zaretskii, 2004/11/26
- Re: $USERPROFILE for $HOME on W32, Andreas Schwab, 2004/11/26
- Re: $USERPROFILE for $HOME on W32, Eli Zaretskii, 2004/11/27
- Re: $USERPROFILE for $HOME on W32, Andreas Schwab, 2004/11/27
- Re: $USERPROFILE for $HOME on W32, Eli Zaretskii, 2004/11/27
- Re: $USERPROFILE for $HOME on W32, Andreas Schwab, 2004/11/27
- Re: $USERPROFILE for $HOME on W32, Eli Zaretskii, 2004/11/25
- Re: $USERPROFILE for $HOME on W32, Stefan Monnier, 2004/11/25
- Re: $USERPROFILE for $HOME on W32, Eli Zaretskii, 2004/11/26
- Re: $USERPROFILE for $HOME on W32, Stefan Monnier, 2004/11/26