nmh-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nmh-commits] nmh mts/smtp/smtp.c ChangeLog


From: Peter Maydell
Subject: [Nmh-commits] nmh mts/smtp/smtp.c ChangeLog
Date: Tue, 29 Apr 2008 20:59:04 +0000

CVSROOT:        /cvsroot/nmh
Module name:    nmh
Changes by:     Peter Maydell <pm215>   08/04/29 20:59:04

Modified files:
        mts/smtp       : smtp.c 
        .              : ChangeLog 

Log message:
        Fix SASL issue properly, by making sm_rrecord() and thus sm_hear() set
        the length of the reply string correctly (the SASL libraries now care
        if you pass in the wrong length).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/nmh/mts/smtp/smtp.c?cvsroot=nmh&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/nmh/ChangeLog?cvsroot=nmh&r1=1.259&r2=1.260

Patches:
Index: mts/smtp/smtp.c
===================================================================
RCS file: /cvsroot/nmh/nmh/mts/smtp/smtp.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- mts/smtp/smtp.c     29 Apr 2008 20:53:33 -0000      1.21
+++ mts/smtp/smtp.c     29 Apr 2008 20:59:04 -0000      1.22
@@ -1,7 +1,7 @@
 /*
  * smtp.c -- nmh SMTP interface
  *
- * $Id: smtp.c,v 1.21 2008/04/29 20:53:33 pm215 Exp $
+ * $Id: smtp.c,v 1.22 2008/04/29 20:59:04 pm215 Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -1688,15 +1688,17 @@
 
     fgets (buffer, BUFSIZ, sm_rfp);
     *len = strlen (buffer);
-    if (ferror (sm_rfp) || feof (sm_rfp))
+    /* *len should be >0 except on EOF, but check for safety's sake */
+    if (ferror (sm_rfp) || feof (sm_rfp) || (*len == 0))
        return sm_rerror ();
     if (buffer[*len - 1] != '\n')
        while (getc (sm_rfp) != '\n' && !ferror (sm_rfp) && !feof (sm_rfp))
            continue;
     else
-       if (buffer[*len - 2] == '\r')
+       if ((*len > 1) && (buffer[*len - 2] == '\r'))
            *len -= 1;
-    buffer[*len - 1] = 0;
+    *len -= 1;
+    buffer[*len] = 0;
 
     return OK;
 }

Index: ChangeLog
===================================================================
RCS file: /cvsroot/nmh/nmh/ChangeLog,v
retrieving revision 1.259
retrieving revision 1.260
diff -u -b -r1.259 -r1.260
--- ChangeLog   29 Apr 2008 20:53:33 -0000      1.259
+++ ChangeLog   29 Apr 2008 20:59:04 -0000      1.260
@@ -3,6 +3,11 @@
        * Revert previous attempt at fix for SASL issue as it
        is the wrong approach.
 
+       * Fix in correct manner, by making sm_rrecord() and thus
+       sm_hear() set the length of the reply string correctly
+       (the SASL libraries now care if you pass in the wrong
+       length).
+
 2008-04-29  Peter Maydell  <address@hidden>
 
        * Cope with sasl_decode64() returning SASL_CONTINUE, as




reply via email to

[Prev in Thread] Current Thread [Next in Thread]