summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2015-05-24 12:07:25 +0200
committerSlávek Banko <slavek.banko@axis.cz>2015-05-24 12:12:14 +0200
commitef128301704f2c7de19e9227c44b2a1021542bb7 (patch)
tree76e06410ecbab553e33ff7cb60619e8a4925d0f6
parent1eeb0bec0b34dafc5000219801440263e2b4c98a (diff)
downloadtdelibs-ef128301704f2c7de19e9227c44b2a1021542bb7.tar.gz
tdelibs-ef128301704f2c7de19e9227c44b2a1021542bb7.zip
Fix hang in TDENetMask::fromCIDRMask() due to point-to-point connections
Signed-off-by: Slávek Banko <slavek.banko@axis.cz> (cherry picked from commit a0189f32f7f986760ab9a5f9b6a71ff09d64c4bf)
-rw-r--r--tdecore/tdehw/tdenetworkconnections.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/tdecore/tdehw/tdenetworkconnections.cpp b/tdecore/tdehw/tdenetworkconnections.cpp
index 934c8f602..dec04e86b 100644
--- a/tdecore/tdehw/tdenetworkconnections.cpp
+++ b/tdecore/tdehw/tdenetworkconnections.cpp
@@ -99,7 +99,8 @@ void TDENetMask::fromCIDRMask(unsigned char mask, bool ipv6) {
unsigned int internalMask = mask;
if (!ipv6) {
m_ipv4NetMask = 0;
- for (i=31;i>=(32-internalMask);i--) {
+ for (i=32; i>(32-internalMask); ) {
+ i--;
SET_BIT(m_ipv4NetMask, i);
}
m_isIPV6 = false;
@@ -109,7 +110,8 @@ void TDENetMask::fromCIDRMask(unsigned char mask, bool ipv6) {
j=0;
unsigned int byteno=0;
memset(maskarray.c, 0, 16);
- for (i=127;i>=(128-internalMask);i--) {
+ for (i=128; i>(128-internalMask); ) {
+ i--;
SET_BIT(maskarray.c[byteno], (i-((15-byteno)*8)));
j++;
if (j>7) {