News for hackers. Stuff that matters.
Re:QtNat – Open you port with Qt UPnP by jeffbee on Friday January 09, 2026 @03:43PM (#46559070)
"My network packets are parsed with C++". I spotted undefined behavior triggered by packet contents in less than 1 minute of reading this example. If the packet contains "\rhttp://" it passes a negative-size `n` parameter to QString::sliced, which is UB.
Re:QtNat – Open you port with Qt UPnP by vablings on Friday January 09, 2026 @04:11PM (#46559388)
Average "well written" C++ program that is free of bugs.
Re:QtNat – Open you port with Qt UPnP by matt_kn on Friday January 09, 2026 @04:39PM (#46559742)
I'm looking at the code but I don't quite see that?

  auto start= result.indexOf("http://");
  ...
  auto end= result.indexOf("\r", start);
  ...
  m_describeUrl= result.sliced(start, end - start);
I don't think end can ever be < start (other than < 0 if not found, which is handled).
Re:QtNat – Open you port with Qt UPnP by jeffbee on Friday January 09, 2026 @04:47PM (#46559828)
Because I'm dumb