[Fwd: Bug#449390: missing error check for getenv]
Noèl Köthe <[email protected]> Sun, 11 Nov 2007 14:28:54 +0100
| Newsgroups | gmane.network.lftp.devel |
|---|---|
| Organization | Debian GNU/Linux, www.debian.org |
| Message-ID | <[email protected]> |
Hello Alexander, here is a minor bug report: -------- Weitergeleitete Nachricht -------- > Von: Nico Golde <[email protected]> > Antwort an: Nico Golde <[email protected]>, [email protected] > An: [email protected] > Betreff: Bug#449390: missing error check for getenv > Datum: Mon, 5 Nov 2007 16:52:39 +0100 > > Package: lftp > Version: 3.5.14-1 > Severity: minor > > Hi, > lftp contains the following code in misc.cc: > 189 >··· home=getenv("HOME"); > 190 } > 191 else > 192 { > 193 >··· // extract user name and find the home > 194 >··· int name_len=(sl?sl-s-1:strlen(s+1)); > 195 >··· char *name=(char*)alloca(name_len+1); > 196 >··· strncpy(name,s+1,name_len); > 197 >··· name[name_len]=0; > 198 > 199 >··· struct passwd *pw=getpwnam(name); > 200 >··· if(pw) > 201 >··· home=pw->pw_dir; > 202 } > 203 if(home==0) > 204 >··· return s; > 205 > 206 if(sl) > 207 { > 208 >··· ret_path=(char*)xrealloc(ret_path,strlen(sl)+strlen(home)+1); > > This code will segfault if HOME is not set because the return value of getenv > is not checked. > Kind regards > Nico > -- Noèl Köthe <[email protected]> Debian GNU/Linux, www.debian.org
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQBHNwOW9/DnDzB9Vu0RAoSBAJ4+Mb4ObGSdB8XrhgWXFnsqU8xXQACaAg9X I4JF994aUaUamgzyThg6LDk= =0Ksb -----END PGP SIGNATURE-----