[evolution-data-server] e-proxy: Eliminate 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 use of undefined C behaviour
- Date: Tue, 20 May 2014 10:10:30 +0000 (UTC)
commit 486db77e3edafcb8086c974d30febf7dcf593471
Author: Philip Withnall <philip withnall collabora co uk>
Date: Mon May 19 14:55:02 2014 +0100
e-proxy: Eliminate use of undefined C behaviour
As much as this works fine in practice (because the function returns an
error, so mask->s_addr should never be used), we should avoid undefined
behaviour. Apparently it kills kittens.
Coverity issue: #1214484
https://bugzilla.gnome.org/show_bug.cgi?id=730379
libedataserver/e-proxy.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/libedataserver/e-proxy.c b/libedataserver/e-proxy.c
index e0cca1c..9639f3a 100644
--- a/libedataserver/e-proxy.c
+++ b/libedataserver/e-proxy.c
@@ -446,9 +446,11 @@ ep_manipulate_ipv4 (ProxyHostAddr *host_addr,
if (*endptr != '\0' || width < 0 || width > 32) {
has_error = TRUE;
+ mask->s_addr = 0xFFFFFFFF;
+ } else {
+ mask->s_addr = htonl (~0 << width);
+ addr->s_addr &= mask->s_addr;
}
- mask->s_addr = htonl (~0 << width);
- addr->s_addr &= mask->s_addr;
} else {
mask->s_addr = 0xFFFFFFFF;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]