net-tools-1.3.6-BETA3 patch for incorrect "ifconfig pointopoint" argument parsing

net-tools-1.3.6-BETA3 patch for incorrect "ifconfig pointopoint" argument parsing

Post by Jonathan Kame » Tue, 07 May 1996 04:00:00



I had to make several patches to net-tools-1.3.6-BETA3 to get it to compile
with a current 1.3.x kernel and libc 5.3.12.  Most of patches were simply a
matter of adding the right include files, so they should be obvious (in fact,
probably more obvious to the maintainers of net-tools, who probably wrote and
maintain most of the relevant include files, than to me :-), so I'm not going
to include them here.  However, I made one non-obvious patch, to ifconfig.c,
to correct its argument parsing of "pointopoint" commands:

--- ./ifconfig.c        1996/02/25 06:03:32     1.1

        }

        if (!strcmp(*spp, "pointopoint")) {
-               if (*++spp != NULL) {
+               if (*(spp + 1) != NULL) {
+                       spp++;
                        strcpy(host, *spp);
                        if (ap->input(host, &sa)) {
                                ap->herror(host);

The problem this patch fixes is the fact that the old version of the code
always incremented the argument pointer, even when there wasn't any argument
after "pointopoint", thus resulting in the pointer getting incremented past
the end of the argument array.  I seem to recall that the most obvious symptom
of this problem was incorrect error messages, but I may be remembering wrong
(I encountered this problem and fixed it a couple of months ago, but I've only
now found the time to submit this patch).

I hope this helps.