From owner-freebsd-questions Sun Jun 24 21:55:18 2001 Delivered-To: freebsd-questions@freebsd.org Received: from falcon.mail.pas.earthlink.net (falcon.mail.pas.earthlink.net [207.217.120.74]) by hub.freebsd.org (Postfix) with ESMTP id 00B1137B405 for ; Sun, 24 Jun 2001 21:55:16 -0700 (PDT) (envelope-from cjc@earthlink.net) Received: from blossom.cjclark.org (dialup-209.247.139.131.Dial1.SanJose1.Level3.net [209.247.139.131]) by falcon.mail.pas.earthlink.net (EL-8_9_3_3/8.9.3) with ESMTP id VAA10536 for ; Sun, 24 Jun 2001 21:55:12 -0700 (PDT) Received: (from cjc@localhost) by blossom.cjclark.org (8.11.4/8.11.3) id f5P4uV115171 for freebsd-questions@freebsd.org; Sun, 24 Jun 2001 21:56:31 -0700 (PDT) (envelope-from cjc) Date: Sun, 24 Jun 2001 21:56:31 -0700 From: "Crist J. Clark" To: freebsd-questions@freebsd.org Subject: How Long hping2 Been Broken? Message-ID: <20010624215631.K11961@blossom.cjclark.org> Reply-To: cjclark@alum.mit.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I just re-installed hping2 on a system and found out it is broken. It uses atoi(3) to get things like sequence and acknowledgement numbers. These are usually written as unsigned integers. But if I do, # hping -R -M 3413718705 -c 1 216.136.204.21 I see in tcpdump(8), 21:48:53.007550 209.247.139.131.13811 > 216.136.204.21.0: R 2147483647:2147483647(0) win 512 Where we see the sequence number has become 2147483647 (0x7fffffff). This indicates an overflow. Try the simple C program, #include #include #include int main(int argc, char *argv[]) { int a; a = atoi(argv[1]); printf("a = %d\nerrno = %d\n",a,errno); return 0; } And, $ cc -o atoi_test atoi_test.c $ ./atoi_test 3413718705 a = 2147483647 errno = 34 Which is exactly what I expect. I read the docs saying that's how atoi(3) should work. But I swear that hping2 used to work. Didn't it? -- Crist J. Clark cjclark@alum.mit.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message