psi-im/iris

xmpp-im/s5b.cpp:2117: bad if test ?

Closed this issue · 3 comments

Source code is

void S5BServer::ss_incomingUDP(const QString &host, int port, const QHostAddress &addr, int sourcePort, const QByteArray &data)
{
if(port != 0 || port != 1)
return;

Suggest swap || for &&. This bug found by gcc compiler flag -Wlogical-op.

Ri0n commented

port is port of sender. it's hardly possible it's less than 1024. strange/invalid logic.
can someone explain?

Hm, the problem isn't in port less than 1024 but with logic - it always return. So this slot does nothing.

Ri0n commented

I checked again the code. It does not look valid at all but I'll apply suggested fix just to make compiler happy.