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

          Issue ID: 9545
           Summary: Compile warnings in OpenLDAP 2.4 branch
           Product: OpenLDAP
           Version: 2.4.58
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: ---
         Component: libraries
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

There are a few compile warnings that are present in OPENLDAP_REL_ENG_2_4
libraries.

I understand that 2.4 is not in an active development state anymore but I think
it's important to keep it as clean as possible as the libraries are actively
used by other projects.

The warnings:

    tls2.c: In function ‘ldap_int_tls_connect’:
    tls2.c:378:9: warning: implicit declaration of function
‘ldap_pvt_tls_check_hostname’ [-Wimplicit-function-declaration]
      378 |   err = ldap_pvt_tls_check_hostname( ld, ssl, host );
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    thr_posix.c: In function ‘ldap_pvt_thread_set_concurrency’:
    thr_posix.c:93:9: warning: implicit declaration of function
‘pthread_setconcurrency’ [-Wimplicit-function-declaration]
       93 |  return pthread_setconcurrency( n );
          |         ^~~~~~~~~~~~~~~~~~~~~~
    thr_posix.c: In function ‘ldap_pvt_thread_get_concurrency’:
    thr_posix.c:107:9: warning: implicit declaration of function
‘pthread_getconcurrency’; did you mean ‘ldap_pvt_thread_get_concurrency’?
[-Wimplicit-function-declaration]
      107 |  return pthread_getconcurrency();
          |         ^~~~~~~~~~~~~~~~~~~~~~
          |         ldap_pvt_thread_get_concurrency
    charray.c: In function ‘ldap_charray2str’:
    charray.c:269:3: warning: ‘strncpy’ specified bound depends on the length
of the source argument [-Wstringop-overflow=]
      269 |   strncpy( p, *v, len );
          |   ^~~~~~~~~~~~~~~~~~~~~
    charray.c:268:9: note: length computed here
      268 |   len = strlen( *v );
          |         ^~~~~~~~~~~~

Additional information:
The 'implicit declaration' warnings can be potentially harmful.

If the compiler does not see the declaration of a function _before_ it is
called, it assumes the following implicit declaration instead:

    int fnc_name();

... which has severe consequences:

1. Only sizeof(int) bytes are read from the return value even if the function
returns a different type.

2. Count and type of the arguments passed to the functions are not checked at
all because the compiler has no means to know what the callee expects as
parameters.

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

Reply via email to