]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Fixe incoming buffer overload section
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sat, 26 Jul 2025 00:19:02 +0000 (20:19 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sat, 26 Jul 2025 00:19:02 +0000 (20:19 -0400)
app/feeder.c
data-feed/feed13.tst [new file with mode: 0644]
lib/devsoc.c

index 31056a0fa4bbf116d0d839e57bab0e276655d3f9..d34e65c47f8d9a53accaea06639a790141975d0c 100644 (file)
@@ -655,7 +655,7 @@ static _Bool scanonefile(FEEDTYP *fd,const char *filename)
 {
 _Bool status;
 int numline;
-char line[200];
+char line[3000];
 int phase;
 _Bool proceed;
 
diff --git a/data-feed/feed13.tst b/data-feed/feed13.tst
new file mode 100644 (file)
index 0000000..2161179
--- /dev/null
@@ -0,0 +1,6 @@
+#====================================================
+T:(feed13) Trying to overcome the entry buffer
+R:220 mailleur.example.com, ESMTP (cleartext) mailleur...
+#====================================================
+S:SSH-2.0-Go
+S:??^EL^S^TÌK>^\^U3^W^[õ¶T6è^RP??^A^Ycurve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1??^B[ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,ssh-dss,ssh-ed25519,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,ssh-dss,ssh-ed25519???<9b>aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,arcfour256,arcfour128,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,arcfour256,arcfour128???<9b>aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,arcfour256,arcfour128,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@EL^S^TÌK>^\^U3"^W^[õ¶T6è^RP??^A^Ycurve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1??^B[ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,ssh-dss,ssh-ed25519,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,ssh-dss,ssh-ed25519???<9b>aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,arcfour256,arcfour128,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,arcfour256,arcfour128???<9b>aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,arcfour256,arcfour128,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@
index f696ba6d3e79272b617ce55feeeeded76aabdfa8..465b7253c7f92674b0c42ba837797d537ab2f518 100644 (file)
@@ -346,7 +346,7 @@ eol=(char *)0;
 phase=0;
 proceed=true;
 while (proceed==true) {
-  //(void) rou_alert(0,"JMPDBG %s phase='%d'",OPEP,phase);
+  //(void) rou_alert(0,"JMPDBG %s phase='%d' carin='%d'",OPEP,phase,soc->carin);
   switch (phase) {
     case 0      :       //Do we have dat in carpile
       if (soc->carin==0)
@@ -356,7 +356,8 @@ while (proceed==true) {
       //(void) rou_alert(0,"%s capile=<%s>",OPEP,soc->carpile);
       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));
+        soc->maxcarin=soc->carin+5;
+        soc->carpile=(char *)realloc(soc->carpile,(soc->maxcarin)*sizeof(char));
         (void) strcat(soc->carpile,soc->EOL);
         }
       break;
@@ -373,6 +374,8 @@ while (proceed==true) {
       break;
     case 4      :       //managing carpile
       soc->carin-=(got+strlen(soc->EOL));
+      if (soc->carin<0)
+        soc->carin=0;
       if (soc->carin>0) {
         int delta;
 
@@ -1202,6 +1205,8 @@ while (proceed==true) {
     case 2      :       //reading data
       buffer=soc->carpile+soc->carin;
       limit=(soc->maxcarin-soc->carin);
+      //(void) rou_alert(0,"%s JMPDBG limit='%d' maxcarin='%d' carin='%d'",
+      //                   OPEP,limit,soc->maxcarin,soc->carin);
       (void) memset(buffer,'\000',limit);
       limit--;
       errno=0;