[PATCH] dropbear-051: errno bug fix

Farrell Aultman fja0568 at gmail.com
Sat Sep 20 06:15:41 WST 2008


The code assumed that when strol is successful, that it will set errno to
zero.  This is not the case, at least
under uClinux.  The man page does not indicate this either.  What can happen
is that errno is already set to non-zero
before strol is called, then strol is successful but since strol doesn't
reset errno to zero, the next line thinks that strol failed.

This patch also gets rid of 2 compiler warnings.

diff -up ../../dropbear-vanilla/dropbear-0.51/cli-runopts.c
../../dropbear-errno/dropbear-0.51/cli-runopts.c
--- ../../dropbear-vanilla/dropbear-0.51/cli-runopts.c    2008-03-27
09:17:14.000000000 -0400
+++ ../../dropbear-errno/dropbear-0.51/cli-runopts.c    2008-09-19
16:26:36.000000000 -0400
@@ -428,12 +428,14 @@ static void addforward(char* origstr, st

     /* Now we check the ports - note that the port ints are unsigned,
      * the check later only checks for >= MAX_PORT */
+    errno = 0;
     newfwd->listenport = strtol(listenport, NULL, 10);
     if (errno != 0) {
         TRACE(("bad listenport strtol"))
         goto fail;
     }

+    errno = 0;
     newfwd->connectport = strtol(connectport, NULL, 10);
     if (errno != 0) {
         TRACE(("bad connectport strtol"))
Common subdirectories: ../../dropbear-vanilla/dropbear-0.51/debian and
../../dropbear-errno/dropbear-0.51/debian
diff -up ../../dropbear-vanilla/dropbear-0.51/keyimport.c
../../dropbear-errno/dropbear-0.51/keyimport.c
--- ../../dropbear-vanilla/dropbear-0.51/keyimport.c    2008-03-27
09:17:14.000000000 -0400
+++ ../../dropbear-errno/dropbear-0.51/keyimport.c    2008-09-19
16:39:08.000000000 -0400
@@ -701,7 +701,6 @@ static int openssh_write(const char *fil
     int nnumbers = -1, pos, len, seqlen, i;
     char *header = NULL, *footer = NULL;
     char zero[1];
-    unsigned char iv[8];
     int ret = 0;
     FILE *fp;
     int keytype = -1;
Common subdirectories: ../../dropbear-vanilla/dropbear-0.51/libtomcrypt and
../../dropbear-errno/dropbear-0.51/libtomcrypt
Common subdirectories: ../../dropbear-vanilla/dropbear-0.51/libtommath and
../../dropbear-errno/dropbear-0.51/libtommath
Common subdirectories: ../../dropbear-vanilla/dropbear-0.51/_MTN and
../../dropbear-errno/dropbear-0.51/_MTN
Only in ../../dropbear-errno/dropbear-0.51: patch051.errno
diff -up ../../dropbear-vanilla/dropbear-0.51/svr-auth.c
../../dropbear-errno/dropbear-0.51/svr-auth.c
--- ../../dropbear-vanilla/dropbear-0.51/svr-auth.c    2008-03-27
09:17:16.000000000 -0400
+++ ../../dropbear-errno/dropbear-0.51/svr-auth.c    2008-09-19
16:38:58.000000000 -0400
@@ -203,7 +203,7 @@ out:
     m_free(methodname);
 }

-static int fill_passwd(const char* username) {
+static void fill_passwd(const char* username) {
     struct passwd *pw = NULL;
     if (ses.authstate.pw_name)
         m_free(ses.authstate.pw_name);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ucc.gu.uwa.edu.au/pipermail/dropbear/attachments/20080919/4b41c528/attachment.htm 


More information about the Dropbear mailing list