Minor bugfixes
Some checks are pending
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Waiting to run
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
C/C++ CI MacOS / ${{ matrix.target }} (macos-15) (push) Waiting to run
C/C++ CI Windows / ${{ matrix.target }} (windows-2022) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (macos-15) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (windows-2022) (push) Waiting to run
C/C++ CI cmake / ubuntu-latest (wolfSSL) (push) Waiting to run

This commit is contained in:
Vladimir Dubrovin 2026-07-23 19:43:47 +03:00
parent 01f85cf755
commit c60af54c98
4 changed files with 22 additions and 7 deletions

View File

@ -122,8 +122,8 @@ void * dnsprchild(struct clientparam* param) {
len+=(type==1?16:28);
}
else if(type == 0x0c) {
unsigned a, b, c, d;
sscanf(host, "%u.%u.%u.%u", &a, &b, &c, &d);
unsigned a = 0, b = 0, c = 0, d = 0;
if(sscanf(host, "%u.%u.%u.%u", &a, &b, &c, &d) != 4) a = b = c = d = 0;
ip = htonl((d<<24) ^ (c<<16) ^ (b<<8) ^ a);
if(*SAFAMILY(&param->sincl) == AF_INET && ip == *(uint32_t *)SAADDR(&param->sincl)){
buf[2] = 0x85;

View File

@ -157,7 +157,7 @@ void * imappchild(struct clientparam* param) {
i = sockgetlinebuf(param, SERVER, srvbuf, sizeof(srvbuf) - 1, '\n', conf.timeouts[STRING_L]);
if( i < 4 ) {RETURN(695);}
srvbuf[i] = 0;
if(strncasecmp((char *)srvbuf, "* OK", 4)||strstr((char *)srvbuf, "IMAP4rev1 Proxy Ready")){RETURN(696);}
if(strncasecmp((char *)srvbuf, "* OK", 4)){RETURN(696);}
if((se = (unsigned char *)strstr((char *)srvbuf, "[CAPABILITY "))){
if(hascap(se, "AUTH=PLAIN")) caps |= CAP_PLAIN;
if(hascap(se, "AUTH=LOGIN")) caps |= CAP_LOGIN;

View File

@ -956,7 +956,13 @@ for(;;){
}
smallbuf[i] = 0;
contentlength64 = 0;
sscanf((char *)smallbuf, "%"SCNx64"", &contentlength64);
if(sscanf((char *)smallbuf, "%"SCNx64"", &contentlength64) != 1) RETURN(537);
/* chunk-size line may be longer than smallbuf: drain and relay the
remainder up to LF so client/backend framing stays in sync */
while(i > 0 && smallbuf[i-1] != '\n'){
if((i = sockgetlinebuf(param, CLIENT, smallbuf, 30, '\n', conf.timeouts[STRING_S])) <= 0) RETURN(537);
if (socksend(param, param->remsock, smallbuf, i, conf.timeouts[STRING_S]) != i) RETURN(536);
}
if(contentlength64 == 0) chunkedcli = 2;
else {
param->waitclient64 = contentlength64;
@ -1144,7 +1150,16 @@ for(;;){
}
smallbuf[i] = 0;
contentlength64 = 0;
sscanf((char *)smallbuf, "%"SCNx64"", &contentlength64);
if(sscanf((char *)smallbuf, "%"SCNx64"", &contentlength64) != 1) {
keepalive = 0;
break;
}
/* chunk-size line may be longer than smallbuf: drain and relay the
remainder up to LF so client/backend framing stays in sync */
while(i > 0 && smallbuf[i-1] != '\n'){
if((i = sockgetlinebuf(param, SERVER, smallbuf, 30, '\n', conf.timeouts[STRING_S])) <= 0) RETURN(534);
if (socksend(param, param->clisock, smallbuf, i, conf.timeouts[STRING_S]) != i) RETURN(535);
}
if(contentlength64 == 0) {
param->chunked = 2;
}

View File

@ -243,7 +243,7 @@ int parsehello(int type, unsigned char *hello, unsigned len, char *sni, int * sn
unsigned xlen;
xlen = size16(hello+offset+2);
if(xlen+4 > elen) return -10;
if(type == 1 && hello[offset] == 0 && hello[offset+1] == 0){
if(type == 1 && xlen >= 5 && hello[offset] == 0 && hello[offset+1] == 0){
snllen=size16(hello+offset+4);
if(snllen>3){
if(snllen+2 != xlen) return -12;
@ -265,7 +265,7 @@ int parsehello(int type, unsigned char *hello, unsigned len, char *sni, int * sn
*lv = hello[offset+5];
}
}
else if(hello[offset] == 0 && hello[offset+1] == 16){
else if(xlen >= 3 && hello[offset] == 0 && hello[offset+1] == 16){
alpnlen=hello[offset+6];
if(alpnlen+7>elen) return -16;
if(alpnlen+1>PROTOLEN) return -17;