]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Improved incoming character overflow incoming from remote
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Fri, 4 Jul 2025 01:47:26 +0000 (21:47 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Fri, 4 Jul 2025 01:47:26 +0000 (21:47 -0400)
Makefile.dbg
lib/devsoc.c
lib/lvleml.c

index 4c30730c387312a22a01021678f6773c3b207a25..e130466d106f581aa85b974abcc638ae795c4d71 100644 (file)
@@ -35,6 +35,8 @@ gorcvr        :  clean debug
                $(EMLPAR)$(TESTITER)
 
 digest :  clean debug
+             gdb                                       \
+               --args                                  \
                                                        \
             ./bin/receiver                             \
                -f                                      \
index 379511ba2d87fa6db47b2388670d096ee1ad329f..9be5479bd831adad40842fb678f8c246b0bb57b7 100644 (file)
@@ -24,7 +24,8 @@
 #include       "unitls.h"
 #include       "devsoc.h"
 
-#define MXCARIN 200     //maximun number of char within carpile
+#define MXCARIN 1200    //maximun number of char within carpile 
+                        //full line sould be more than 998 char
 
 typedef struct  {
         PROTYP proto;   //Connexion protocol type
@@ -359,7 +360,7 @@ while (proceed==true) {
 /*     Procedure to extract next line from the socket  */
 /*      incoming pile.                                  */
 /*      Return the number of character, zero if the     */
-/*      line is empty, -1 if now char available.        */
+/*      line is empty, -1 if no char are available.     */
 /*                                                      */
 /********************************************************/
 static int doextract(SOCTYP *soc,char **lineptr)
@@ -384,26 +385,34 @@ while (proceed==true) {
       if (soc->carin==0)
         phase=999;      //No char,no need to check for line
       break;
-    case 1      :       //Do we have a CRLF
+    case 1      :       //do we have a buffer full;
+      if (soc->carin>=(soc->maxcarin)-1) {
+        //Overload! trying to overcome by extending carpile an adding an EOL
+        soc->carpile=(char *)realloc(soc->carpile,(soc->carin+5)*sizeof(char));
+        (void) strcat(soc->carpile,soc->EOL);
+        }
+      break;
+    case 2      :       //Do we have a CRLF
       eol=strstr(soc->carpile,soc->EOL);
       if (eol==(char *)0) 
         phase=999;      //No End Of Line yet
       break;
-    case 2      :       //duplicating carpile
+    case 3      :       //duplicating carpile
       *lineptr=calloc(soc->carin+1,sizeof(char));
       *eol='\000';
       (void) strcpy(*lineptr,soc->carpile);
       got=strlen(*lineptr);
       break;
-    case 3      :       //managing carpile
+    case 4      :       //managing carpile
       soc->carin-=(got+strlen(soc->EOL));
       if (soc->carin>0) {
         int delta;
 
         delta=got+strlen(soc->EOL);
-        (void) memmove(soc->carpile,soc->carpile+delta,soc->carin);
+        (void) memmove(soc->carpile,soc->carpile+delta,soc->carin+1);
         }
-      soc->carpile[soc->carin]='\000';
+      //soc->carpile[soc->carin]='\000';
+      (void) rou_alert(0,"%s carpile=<%s>",OPEP,soc->carpile);
       break;
     default     :       //SAFE guard
       proceed=false;
index 243959b87b126f06c4e0832838aa25602b038253..383db7a31cd0c80820f17ec92bbf8603d7029f44 100644 (file)
@@ -368,8 +368,10 @@ decoded=(char *)0;
 cur.tv_nsec/=10000;     //100 millisec
 //(void) rou_asprintf(&seq,"<%05d-%s@%s>",
 //                         cur.tv_nsec,contact->session->sessid,contact->locname);
-seq=strdup("<01234567890ABCDEFGHIJKLMNOPQRST@mailpostg.example.com>");
+//seq=strdup("<01234567890ABCDEFGHIJKLMNOPQRST@mailpostg.example.com>");
 //seq=strdup("username = <jmp@safe.ca>");
+//seq=strdup("realm=\"elwood.innosoft.com\",nonce=\"OA6MG9tEQGm2hh\",qop=\"auth\",algorithm=md5-sess,charset=utf-8");
+seq=strdup("realm=\"example.com\",nonce=\"0123456789\",algorithm=md5-sess");
 (void) rou_alert(0,"%s JMPDBG SEQ=<%s>",OPEP,seq);
 code=(char *)0;
 usr=(USRTYP *)0;