]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Detecting '\000' within incoming SMTP protocol
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 13 Aug 2024 09:12:22 +0000 (05:12 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 13 Aug 2024 09:12:22 +0000 (05:12 -0400)
lib/devsoc.c
lib/subrou.c

index 7d895d20644a3b7ed66443fa677406a47dbb2886..eb3bda8a87d03a3c57be801f09a8e73df77407d1 100644 (file)
@@ -814,8 +814,10 @@ if (soc!=(SOCTYP *)0) {
   int limit;
   char *buffer;
 
-  limit=(soc->maxcarin-soc->carin)-1;
   buffer=soc->carpile+soc->carin;
+  limit=(soc->maxcarin-soc->carin);
+  (void) memset(buffer,'\000',limit);
+  limit--;
   switch (soc->modtls) {
     case true   :
       got=tls_read(soc->tls,buffer,limit);
@@ -842,6 +844,14 @@ if (soc!=(SOCTYP *)0) {
       break;
     }
   if (got>0) {                 //we have recived some character
+    char *ptr;
+    //removing NULL char if received 
+    ptr=buffer;
+    for (int i=0;i<got;i++,ptr++) {
+      if (*ptr=='\000')
+        *ptr='?';
+      }
     soc->carin+=got;           //managing carpile
     soc->carpile[soc->carin]='\000';
     }
index f995dd4bbf4a033dcc7ddc930ee0a0507a7440ed..044bd1ae995e37251279f5c74ee0dbf1485e06f5 100644 (file)
@@ -21,7 +21,7 @@
 
 //version definition 
 #define VERSION "0.4.1"
-#define RELEASE "2"
+#define RELEASE "3"
 
 //Public variables
 PUBLIC  int debug=0;            //debug level