2018-03-01 16:50 GMT+01:00 Pierre Emeriaud <petrus.lt+open...@gmail.com>:
>> I found an interesting behavior with bgplg when used as cgi-bin. It
>> fails with "show ip bgp {as|source-as|transit-as}" at least when as is
>> < 10.

The following seems to fix the issue, but I may have overlooked some
things. Both cgi-bin and bgplgsh works fine now. Thanks Denis :)

Index: bgplg.c
===================================================================
RCS file: /cvs/src/usr.bin/bgplg/bgplg.c,v
retrieving revision 1.18
diff -u -p -r1.18 bgplg.c
--- bgplg.c     18 Dec 2017 09:12:49 -0000      1.18
+++ bgplg.c     2 Mar 2018 13:29:57 -0000
@@ -160,7 +160,7 @@ lg_arg2argv(char *arg, int *argc)
        len = strlen(arg);

        /* Count elements */
-       for (i = 0; i < (len - 1); i++) {
+       for (i = 0; i < len; i++) {
                if (isspace((unsigned char)arg[i])) {
                        /* filter out additional options */
                        if (arg[i + 1] == '-') {
@@ -182,7 +182,7 @@ lg_arg2argv(char *arg, int *argc)
        *argc = c;

        /* Fill array */
-       for (i = c = 0; i < (len - 1); i++) {
+       for (i = c = 0; i < len; i++) {
                if (arg[i] == '\0' || i == 0) {
                        if (i != 0)
                                ptr = &arg[i + 1];

Reply via email to