OSSP CVS Repository

ossp - Check-in [583]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 583
Date: 2001-Aug-01 09:07:55 (local)
2001-Aug-01 07:07:55 (UTC)
User:thl
Branch:
Comment: improved robustness adding some parameter sanit checks
Tickets:
Inspections:
Files:
ossp-pkg/lmtp2nntp/lmtp.c      1.7 -> 1.8     6 inserted, 2 deleted

ossp-pkg/lmtp2nntp/lmtp.c 1.7 -> 1.8

--- lmtp.c       2001/07/26 15:18:57     1.7
+++ lmtp.c       2001/08/01 07:07:55     1.8
@@ -96,12 +96,12 @@
      *  the _io_ structure by NULLing it causes use of the system default
      *  function.
      */
-    lmtp_t *lmtp = NULL;
+    lmtp_t *lmtp;
 
     if ((lmtp = (lmtp_t *)malloc(sizeof(lmtp_t))) == NULL) 
         return NULL;
 
-    if(io == NULL) {
+    if (io == NULL) {
         lmtp->io.read  = read;
         lmtp->io.write = write;
     } else {
@@ -128,6 +128,8 @@
 {
     int i;
 
+    if (lmtp == NULL)
+        return;
     for (i = 0; (i < LMTP_MAXVERBS) && (lmtp->dispatch[i] != NULL); i++)
         free(lmtp->dispatch[i]);    /* lmtp_register() */
     free(lmtp->dispatch);           /* lmtp_create() */
@@ -142,6 +144,8 @@
     char c;
     lmtp_readline_t *rl = &lmtp->rl;
 
+    if (lmtp == NULL)
+        return LMTP_ERR_ARG;
     for (n = 0; n < buflen-1;) {
 
         /* fetch one character (but read more) */

CVSTrac 2.0.1