[PATCH 12/12] bug fix: openssh 4.3p2 ssh-rand-helper bugs

This is a discussion on [PATCH 12/12] bug fix: openssh 4.3p2 ssh-rand-helper bugs within the OpenSSH Development forums, part of the Networking and Network Related category; There are 2 bugs here. Since mkdir can return an error. The rest of the function's operations depend on ...


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 12/12] bug fix: openssh 4.3p2 ssh-rand-helper bugs

There are 2 bugs here. Since mkdir can return an error. The rest of
the function's operations depend on this directory being created thus an
error should be handled at this point.

The second is f is never closed. This patch adds the needed fclose.

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>
---
ssh-rand-helper.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletion(-)

diff -uprN openssh-4.3p2/ssh-rand-helper.c openssh-4.3p2-kylie/ssh-rand-helper.c
--- openssh-4.3p2/ssh-rand-helper.c 2005-07-17 02:26:44.000000000 -0500
+++ openssh-4.3p2-kylie/ssh-rand-helper.c 2006-05-08 15:22:13.967153672 -0500
@@ -564,7 +564,8 @@ prng_write_seedfile(void)
/* Try to ensure that the parent directory is there */
snprintf(filename, sizeof(filename), "%.512s/%s", pw->pw_dir,
_PATH_SSH_USER_DIR);
- mkdir(filename, 0700);
+ if (mkdir(filename, 0700) < 0)
+ fatal("mkdir: %s", strerror(errno));

snprintf(filename, sizeof(filename), "%.512s/%s", pw->pw_dir,
SSH_PRNG_SEED_FILE);
@@ -774,6 +775,7 @@ prng_read_commands(char *cmdfilename)
debug("Loaded %d entropy commands from %.100s", cur_cmd,
cmdfilename);

+ fclose(f);
return cur_cmd < MIN_ENTROPY_SOURCES ? -1 : 0;
}



_______________________________________________
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 06:26 AM.


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