[PATCH 5/12] bug fix: openssh-4.3p2 scp bugs

This is a discussion on [PATCH 5/12] bug fix: openssh-4.3p2 scp bugs within the OpenSSH Development forums, part of the Networking and Network Related category; There are 2 bugs here. The first is pipe's return code is not checked in this instance and it ...


Go Back   Usenet Forums > Networking and Network Related > OpenSSH Development

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-16-2006
Kylene Jo Hall
 
Posts: n/a
Default [PATCH 5/12] bug fix: openssh-4.3p2 scp bugs

There are 2 bugs here. The first is pipe's return code is not checked
in this instance and it can return a negative value. The purpose of the
call is to make sure 0 and 1 are not assigned to the pin and pout
descriptors because those values won't work for later calls. If the
pipe call fails the correct behavior cannot be ensured. This patch adds
an error case consistent with the rest of the function.

The second bug is a memory leak. arg is allocated with xstrdup. It is
the assigned in some paths to another local variable but neither are
ever freed. This patch adds the xfree.

This entire set of patches passed the regression tests on my system.
Bugs found by Coverity.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
---
scp.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletion(-)

diff -uprN openssh-4.3p2/scp.c openssh-4.3p2-kylie/scp.c
--- openssh-4.3p2/scp.c 2006-01-31 05:11:38.000000000 -0600
+++ openssh-4.3p2-kylie/scp.c 2006-05-08 15:15:04.016516104 -0500
@@ -181,7 +181,8 @@ do_cmd(char *host, char *remuser, char *
* Reserve two descriptors so that the real pipes won't get
* descriptors 0 and 1 because that will screw up dup2 below.
*/
- pipe(reserved);
+ if (pipe(reserved) < 0)
+ fatal("pipe: %s", strerror(errno));

/* Create a socket pair for communicating with ssh. */
if (pipe(pin) < 0)
@@ -490,6 +491,7 @@ toremote(char *targ, int argc, char **ar
source(1, argv + i);
}
}
+ xfree(arg);
}

void


_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
http://www.mindrot.org/mailman/listi...enssh-unix-dev
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:25 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0