From: Jean-Marc Pigeon (Delson) Date: Tue, 13 Aug 2024 09:12:22 +0000 (-0400) Subject: Detecting '\000' within incoming SMTP protocol X-Git-Tag: tag-0.4.2~3 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=8a56c8707c17ad46867fa63bb9f89a9a43bd3dd9;p=jmp%2Fmailleur Detecting '\000' within incoming SMTP protocol --- diff --git a/lib/devsoc.c b/lib/devsoc.c index 7d895d2..eb3bda8 100644 --- a/lib/devsoc.c +++ b/lib/devsoc.c @@ -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;icarin+=got; //managing carpile soc->carpile[soc->carin]='\000'; } diff --git a/lib/subrou.c b/lib/subrou.c index f995dd4..044bd1a 100644 --- a/lib/subrou.c +++ b/lib/subrou.c @@ -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