![]() |
lvs-devel
|
| To: | wzt.wzt@xxxxxxxxx |
|---|---|
| Subject: | Re: [PATCH] IPVS: replace sprintf to snprintf to avoid stack buffer overflow |
| Cc: | linux-kernel@xxxxxxxxxxxxxxx, Wensong Zhang <wensong@xxxxxxxxxxxx>, Julian Anastasov <ja@xxxxxx>, netdev@xxxxxxxxxxxxxxx, lvs-devel@xxxxxxxxxxxxxxx, Patrick McHardy <kaber@xxxxxxxxx> |
| From: | Simon Horman <horms@xxxxxxxxxxxx> |
| Date: | Tue, 6 Apr 2010 13:22:49 +1000 |
On Tue, Apr 06, 2010 at 10:50:20AM +0800, wzt.wzt@xxxxxxxxx wrote:
> IPVS not check the length of pp->name, use sprintf will cause stack buffer
> overflow.
> struct ip_vs_protocol{} declare name as char *, if register a protocol as:
> struct ip_vs_protocol ip_vs_test = {
> .name = "aaaaaaaa....128...aaa",
> .debug_packet = ip_vs_tcpudp_debug_packet,
> };
>
> when called ip_vs_tcpudp_debug_packet(), sprintf(buf, "%s TRUNCATED",
> pp->name);
> will cause stack buffer overflow.
>
> Signed-off-by: Zhitong Wang <zhitong.wangzt@xxxxxxxxxxxxxxx>
I think that the simple answer is, don't do that.
But your patch seems entirely reasonable to me.
Acked-by: Simon Horman <horms@xxxxxxxxxxxx>
Patrick, please consider merging this.
--
To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [PATCH] IPVS: replace sprintf to snprintf to avoid stack buffer overflow, Changli Gao |
|---|---|
| Next by Date: | Re: [PATCH] IPVS: replace sprintf to snprintf to avoid stack buffer overflow, Simon Horman |
| Previous by Thread: | Re: [PATCH] IPVS: replace sprintf to snprintf to avoid stack buffer overflow, Simon Horman |
| Next by Thread: | Re: [PATCH] IPVS: replace sprintf to snprintf to avoid stack buffer overflow, Patrick McHardy |
| Indexes: | [Date] [Thread] [Top] [All Lists] |