[patch] sftp-server basepath [yet another]
Darren Tucker
dtucker at zip.com.au
Sun Sep 2 23:06:52 EST 2007
On Sat, Sep 01, 2007 at 05:22:11PM -0300, Bruno Cesar Ribas wrote:
> I made this simple path to make sftp-server restricted to a basepath!
[...]
> + if(strncmp(basepath,realpath(path,NULL),strlen(basepath))==0) {
Passing a NULL as the second argument to realpath is a) nonstandard and
b) makes it malloc the returned string, so this leaks memory. Also,
realpath can fail and return NULL, in which case this would segfault.
--
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
More information about the openssh-unix-dev
mailing list