https://bugs.openldap.org/show_bug.cgi?id=9899

          Issue ID: 9899
           Summary: "cyrus.c" uses non-portable GNU extension for void
                    pointer arithmetics and fails on HP-UX aCC
           Product: OpenLDAP
           Version: 2.6.3
          Hardware: All
                OS: Other
            Status: UNCONFIRMED
          Keywords: needs_review
          Severity: normal
          Priority: ---
         Component: libraries
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

On HP-UX with cc: HP C/aC++ B3910B A.06.29 [Oct 18 2016]
tells me
libtool: compile:  /opt/aCC/bin/aCC -Ae -g -I../../include -I../../include
-I/opt/ports/include -DLDAP_LIBRARY -c cyrus.c  -DPIC -o .libs/cyrus.o
"cyrus.c", line 420: error #3143: arithmetic on pointer to void or function
          type
        memcpy( cb_data + plen, cbv.bv_val, cbv.bv_len );
                        ^

1 error detected in the compilation of "cyrus.c".
gmake[2]: *** [Makefile:434: cyrus.lo] Error 1

void pointer arithmetics is not valid/undefined and just a GNU extension
supported by GCC or clang.
I was able to reproduce this on FreeBSD clang version 13.0.0
([email protected]:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a303):
osipovmi@deblndw011x:~/var/Projekte/openldap-2.6.3/libraries/libldap
$ cc -std=c17 -I../../include -I../../include -I/usr/local/include
-DLDAP_LIBRARY -c cyrus.c -o cyrus.o -pedantic -Werror
cyrus.c:420:18: error: arithmetic on a pointer to void is a GNU extension
[-Werror,-Wpointer-arith]
        memcpy( cb_data + plen, cbv.bv_val, cbv.bv_len );
                ~~~~~~~ ^
1 error generated.

I am not a daily C hacker, but I guess cb_data needs to be typed to "unsigned
char" just like data from sasl_channel_binding_t
(https://github.com/cyrusimap/cyrus-sasl/blob/cb549ef71c5bb646fe583697ebdcaba93267a237/include/sasl.h#L846-L851).

Or at least a malloc with an "unsigned char", save the pointer start address,
copy the prefix, increment by prefix length, copy the channel binding value and
then assign the pointer start address to the output struct.

I will unset SASL_CHANNEL_BINDING for now since it is not required in your AD
environment when SASL GSSAPI with minssf=1 is set.

-- 
You are receiving this mail because:
You are on the CC list for the issue.

Reply via email to