OSSP CVS Repository

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

Check-in Number: 4472
Date: 2004-Apr-02 12:38:13 (local)
2004-Apr-02 10:38:13 (UTC)
User:thl
Branch:
Comment: correctly handle and detect empty newsgroups
Tickets:
Inspections:
Files:
ossp-pkg/lmtp2nntp/lmtp2nntp_main.c      1.78 -> 1.79     4 inserted, 4 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp_msg.c      1.40 -> 1.41     1 inserted, 1 deleted

ossp-pkg/lmtp2nntp/lmtp2nntp_main.c 1.78 -> 1.79

--- lmtp2nntp_main.c     2004/04/02 10:35:40     1.78
+++ lmtp2nntp_main.c     2004/04/02 10:38:13     1.79
@@ -1466,8 +1466,8 @@
                 return LMTP_ERR_MEM;
             }
         }
-        ctx->msg->azNewsgroups = memcpy(cp, ctx->msg->azEnvgroups, ctx->msg->asEnvgroups);
-        ctx->msg->asNewsgroups =                                   ctx->msg->asEnvgroups;
+        ctx->msg->azNewsgroups = memcpy(cp, ctx->msg->azEnvgroups != NULL ? ctx->msg->azEnvgroups : "", ctx->msg->asEnvgroups);
+        ctx->msg->asNewsgroups = ctx->msg->asEnvgroups;
     }
     else if (ctx->option_groupmode == GROUPMODE_ARG) {
         if ((cp = malloc(ctx->asGroupargs + 1)) == NULL) {
@@ -1484,8 +1484,8 @@
                 return LMTP_ERR_MEM;
             }
         }
-        ctx->msg->azNewsgroups = memcpy(cp, ctx->azGroupargs, ctx->asGroupargs);
-        ctx->msg->asNewsgroups =                              ctx->asGroupargs;
+        ctx->msg->azNewsgroups = memcpy(cp, ctx->azGroupargs != NULL ? ctx->azGroupargs : "", ctx->asGroupargs);
+        ctx->msg->asNewsgroups = ctx->asGroupargs;
     }
     else { /*                      == GROUPMODE_HEADER */
         cp = ctx->msg->azNewsgroups;


ossp-pkg/lmtp2nntp/lmtp2nntp_msg.c 1.40 -> 1.41

--- lmtp2nntp_msg.c      2003/02/12 15:24:18     1.40
+++ lmtp2nntp_msg.c      2004/04/02 10:38:13     1.41
@@ -243,7 +243,7 @@
     size_t       asNewheaders;
 
     logbook(msg->l2, L2_LEVEL_DEBUG, "verify Newsgroups");
-    if (msg->azNewsgroups == NULL)
+    if ((msg->azNewsgroups == NULL) || (msg->asNewsgroups == 0))
         return MSG_ERR_JOINGROUPNONE;
     argz_stringify(msg->azNewsgroups, msg->asNewsgroups, ',');
     if (strlen(msg->azNewsgroups) == 0)

CVSTrac 2.0.1