X-Git-Url: http://www.dolda2000.com/gitweb/?p=ashd.git;a=blobdiff_plain;f=src%2Fhtparser.c;h=ba76d01be0fc4e38b5ae7bd4af41e91816e5e961;hp=5179a25935a0e9f328e771edf8b159f32c988a42;hb=e2b404ab58259bb538e2d785d6ebbe9e9263bbef;hpb=0370bd82128b41fdbd5fbcbcac35104c0ede60fa diff --git a/src/htparser.c b/src/htparser.c index 5179a25..ba76d01 100644 --- a/src/htparser.c +++ b/src/htparser.c @@ -77,6 +77,8 @@ static struct hthead *parsereq(FILE *in) goto fail; } else { bufadd(method, c); + if(method.d >= 128) + goto fail; } } while(1) { @@ -87,6 +89,8 @@ static struct hthead *parsereq(FILE *in) goto fail; } else { bufadd(url, c); + if(url.d >= 65536) + goto fail; } } while(1) { @@ -98,6 +102,8 @@ static struct hthead *parsereq(FILE *in) goto fail; } else { bufadd(ver, c); + if(ver.d >= 128) + goto fail; } } bufadd(method, 0); @@ -140,6 +146,8 @@ static struct hthead *parseresp(FILE *in) goto fail; } else { bufadd(ver, c); + if(ver.d >= 128) + goto fail; } } while(1) { @@ -150,6 +158,8 @@ static struct hthead *parseresp(FILE *in) goto fail; } else { code = (code * 10) + (c - '0'); + if(code >= 10000) + goto fail; } } while(1) { @@ -161,6 +171,8 @@ static struct hthead *parseresp(FILE *in) goto fail; } else { bufadd(msg, c); + if(msg.d >= 512) + goto fail; } } bufadd(msg, 0);