Package: dhcping
Version: 1.2-2
Severity: grave
Tags: patch
Justification: renders package unusable
dhcping uses getopt(3) to parse commandline options. In doing
this, it goes into an infinite loop while parsing the command
"dhcping -c 172.16.10.3 -s 172.16.10.2 -h 00:10:57:C0:1B:E6"
The code in question is
char ch;
...
while ((ch = getopt(argc,argv,"c:g:h:iqrs:t:vV"))>0) {
getopt() returns -1 at the end of the options, but when assigned to a
"char" variable this becomes the value 255. Hence the test is always
true, and the while... loops indefinitely.
The simple patch (attached) changes the variable from a char to an int.
-- System Information:
Debian Release: 3.1
Architecture: arm (armv4l)
Kernel: Linux 2.4.27-netwinder
Locale: LANG=da_DK, LC_CTYPE=da_DK (charmap=ISO-8859-1)
Versions of packages dhcping depends on:
ii libc6 2.3.2.ds1-22 GNU C Library: Shared libraries an
-- no debconf information
--- dhcping.c.orig 2002-01-27 03:18:58.000000000 +0100
+++ dhcping.c 2005-09-07 15:20:18.000000000 +0200
@@ -70,7 +70,7 @@
int maxwait=3;
void doargs(int argc,char **argv) {
- char ch;
+ int ch;
inform=request=verbose=VERBOSE=quiet=0;
ci=gi=server="0.0.0.0";