All of lore.kernel.org
 help / color / mirror / Atom feed
* ip_queue, is this safe:
@ 2003-08-01 10:50 Peteris Krumins
  2003-08-01 15:25 ` James Morris
  0 siblings, 1 reply; 3+ messages in thread
From: Peteris Krumins @ 2003-08-01 10:50 UTC (permalink / raw)
  To: netfilter-devel

Hello,

  I have written an application which uses ip_queue mechanism to quickly
  push (of course only some) packets from kernel space to user space.
  (The packets are queued in PREROUTING, mangle)
  The application is quite big and i bet i have made several mistakes,
  leaving unpleasent buffer overflows and something more.

  what i am interested in is if this is safe to write:

---
  [...]
  struct iphdr *ip;
  ip = (struct iphdr *)packet->payload;

  if (ip->protocol == IPPROTO_TCP) {
      struct tcphdr *tcp;

      tcp = (struct tcphdr *)(packet->payload + ip->ihl*4);
      [...]
  }
  [...]
---

  i am doubting:
  tcp = (struct tcphdr *)(packet->payload + ip->ihl*4);

  because ip->ihl could be faked, couldnt it? The packet would get queued
  and if ip->ihl is something faked, using the tcp pointer i'd get a
  segfault, wouldn't i?


P.Krumins

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-08-02 21:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-01 10:50 ip_queue, is this safe: Peteris Krumins
2003-08-01 15:25 ` James Morris
2003-08-02 21:33   ` Re[2]: " Peteris Krumins

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.