Commit 80b78c3
ipvs: prevent integer overflow in do_ip_vs_get_ctl()
The get->num_services variable is an unsigned int which is controlled by
the user. The struct_size() function ensures that the size calculation
does not overflow an unsigned long, however, we are saving the result to
an int so the calculation can overflow.
Both "len" and "get->num_services" come from the user. This check is
just a sanity check to help the user and ensure they are using the API
correctly. An integer overflow here is not a big deal. This has no
security impact.
Save the result from struct_size() type size_t to fix this integer
overflow bug.
Fixes: 1da177e ("Linux-2.6.12-rc2")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>1 parent c21b02f commit 80b78c3
1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3091 | 3091 | | |
3092 | 3092 | | |
3093 | 3093 | | |
3094 | | - | |
| 3094 | + | |
3095 | 3095 | | |
3096 | 3096 | | |
3097 | 3097 | | |
3098 | 3098 | | |
3099 | | - | |
| 3099 | + | |
3100 | 3100 | | |
3101 | 3101 | | |
3102 | 3102 | | |
| |||
3132 | 3132 | | |
3133 | 3133 | | |
3134 | 3134 | | |
3135 | | - | |
| 3135 | + | |
3136 | 3136 | | |
3137 | 3137 | | |
3138 | 3138 | | |
3139 | 3139 | | |
3140 | | - | |
| 3140 | + | |
3141 | 3141 | | |
3142 | 3142 | | |
3143 | 3143 | | |
| |||
0 commit comments