[evolution-data-server] e-proxy: Eliminate more use of undefined C behaviour
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] e-proxy: Eliminate more use of undefined C behaviour
- Date: Mon, 3 Nov 2014 16:05:06 +0000 (UTC)
commit 81353faf4d5450031335ed414ff9e46a3fa460c2
Author: Philip Withnall <philip tecnocode co uk>
Date: Sat Nov 1 13:31:22 2014 +0000
e-proxy: Eliminate more use of undefined C behaviour
The previous fix for this issue (commit 486db77e) did not eliminate
the undefined behaviour in the case where width == 32.
Fix that by explicitly handling it separately.
Coverity issue: #1214484
https://bugzilla.gnome.org/show_bug.cgi?id=730379
libedataserver/e-proxy.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/libedataserver/e-proxy.c b/libedataserver/e-proxy.c
index 25afcf8..40530b7 100644
--- a/libedataserver/e-proxy.c
+++ b/libedataserver/e-proxy.c
@@ -425,6 +425,8 @@ ep_need_proxy_socks (EProxy *proxy,
return !ep_is_in_ignored (proxy, host);
}
+/* Apply a prefix-notation @netmask to the given @addr_in, as described in
+ * http://tools.ietf.org/html/rfc4632#section-3.1 */
static gboolean
ep_manipulate_ipv4 (ProxyHostAddr *host_addr,
struct in_addr *addr_in,
@@ -448,6 +450,9 @@ ep_manipulate_ipv4 (ProxyHostAddr *host_addr,
if (*endptr != '\0' || width < 0 || width > 32) {
has_error = TRUE;
mask->s_addr = 0xFFFFFFFF;
+ } else if (width == 32) {
+ mask->s_addr = 0;
+ addr->s_addr = 0;
} else {
mask->s_addr = htonl (~0 << width);
addr->s_addr &= mask->s_addr;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]