You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by so...@apache.org on 2005/08/15 02:02:51 UTC

svn commit: r232679 - /httpd/mod_smtpd/trunk/smtp_protocol.c

Author: soc-rian
Date: Sun Aug 14 17:02:50 2005
New Revision: 232679

URL: http://svn.apache.org/viewcvs?rev=232679&view=rev
Log:
Fixed rcpt_to hash table index number allocation problem.

Modified:
    httpd/mod_smtpd/trunk/smtp_protocol.c

Modified: httpd/mod_smtpd/trunk/smtp_protocol.c
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/smtp_protocol.c?rev=232679&r1=232678&r2=232679&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/smtp_protocol.c (original)
+++ httpd/mod_smtpd/trunk/smtp_protocol.c Sun Aug 14 17:02:50 2005
@@ -344,6 +344,7 @@
   char *loc;
   char *allocated_string;
   int retval = 0;
+  int *new_elt;
 
   // need mail first
   if ((sr->state_vector != SMTPD_STATE_GOT_MAIL) &&
@@ -412,8 +413,18 @@
   // add a recipient
 
   if ((allocated_string = apr_pstrdup(sr->p, loc))) {
-    apr_hash_set(sr->rcpt_to, &(sr->r_index),
-		 sizeof(sr->r_index), allocated_string);
+    new_elt = apr_palloc(sr->p, sizeof(int));
+
+    if (!new_elt) {
+      ap_rprintf(r, "%d %s\r\n", 421, "Error: Internal");
+      // out of memory close connection
+      retval = 0;
+      goto end;
+    }
+
+    *new_elt = sr->r_index;
+    apr_hash_set(sr->rcpt_to, new_elt,
+		 sizeof(*new_elt), allocated_string);
     sr->r_index++;
     sr->state_vector = SMTPD_STATE_GOT_RCPT;