[OpenSIPS-Devel] [OpenSIPS/opensips] 23462a: freeswitch ESL: Fix string truncation compiler war...

Liviu Chircu noreply at github.com
Wed May 29 09:48:57 EDT 2019


  Branch: refs/heads/3.0
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 23462ab3bb9d303a752e589d618e4b67f51d2f3b
      https://github.com/OpenSIPS/opensips/commit/23462ab3bb9d303a752e589d618e4b67f51d2f3b
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2019-05-29 (Wed, 29 May 2019)

  Changed paths:
    M modules/freeswitch/esl/src/esl.c
    M modules/freeswitch/esl/src/include/esl_config.h

  Log Message:
  -----------
  freeswitch ESL: Fix string truncation compiler warnings

esl/src/esl.c: In function ‘esl_recv_event’:
esl/src/esl.c:1406:4: warning: ‘strncpy’ specified bound 1024 equals
destination size [-Wstringop-truncation]
    strncpy(handle->last_reply, hval, sizeof(handle->last_reply));
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In function ‘esl_send_recv_timed.part.6’,
    inlined from ‘esl_send_recv_timed’ at esl/src/esl.c:1537:27:
esl/src/esl.c:1604:5: warning: ‘strncpy’ specified bound 1024 equals
destination size [-Wstringop-truncation]
     strncpy(handle->last_sr_reply, hval, sizeof(handle->last_sr_reply));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In file included from esl/src/esl_config.c:34:
esl/src/esl_config.c: In function ‘esl_config_open_file’:
esl/src/include/esl.h:43:37: warning: ‘strncpy’ output may be truncated
copying 511 bytes from a string of length 1023 [-Wstringop-truncation]
 #define esl_copy_string(_x, _y, _z) strncpy(_x, _y, _z - 1)
                                     ^~~~~~~~~~~~~~~~~~~~~~~
esl/src/include/esl.h:44:32: note: in expansion of macro ‘esl_copy_string’
 #define esl_set_string(_x, _y) esl_copy_string(_x, _y, sizeof(_x))
                                ^~~~~~~~~~~~~~~
esl/src/esl_config.c:72:4: note: in expansion of macro ‘esl_set_string’
    esl_set_string(cfg->path, path);
    ^~~~~~~~~~~~~~

Reported by Dan Pascu

(cherry picked from commit d20f163f3bceb213e4a7937a43074bf106ad9aaf)





More information about the Devel mailing list