Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Jun 2001 21:56:31 -0700
From:      "Crist J. Clark" <cristjc@earthlink.net>
To:        freebsd-questions@freebsd.org
Subject:   How Long hping2 Been Broken?
Message-ID:  <20010624215631.K11961@blossom.cjclark.org>

next in thread | raw e-mail | index | archive | help
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 <stdio.h>
#include <stdlib.h>
#include <errno.h>

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010624215631.K11961>