Project

General

Profile

Bug #3421

gcc 8.1.0 fails to build libosmocore: src/socket.c:599:2: error: ‘strncpy’ specified bound 108 equals destination size [-Werror=stringop-truncation]

Added by neels 5 months ago. Updated 3 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
07/26/2018
Due date:
% Done:

100%

Spec Reference:

Description

▶ gcc --version
gcc (Debian 8.1.0-12) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
make -C libosmocore -j 9 check
make[1]: Entering directory '/n/s/dev/make/libosmocore'
make  check-recursive
make[2]: Entering directory '/n/s/dev/make/libosmocore'
Making check in include
make[3]: Entering directory '/n/s/dev/make/libosmocore/include'
make  check-am
make[4]: Entering directory '/n/s/dev/make/libosmocore/include'
make[4]: Nothing to be done for 'check-am'.
make[4]: Leaving directory '/n/s/dev/make/libosmocore/include'
make[3]: Leaving directory '/n/s/dev/make/libosmocore/include'
Making check in src
make[3]: Entering directory '/n/s/dev/make/libosmocore/src'
make  check-am
make[4]: Entering directory '/n/s/dev/make/libosmocore/src'
  CC       socket.lo
  CC       sercomm.lo
  CC       prbs.lo
  CC       isdnhdlc.lo
  CC       conv_acc_sse.lo
  CC       conv_acc_sse_avx.lo
  CC       msgfile.lo
  CC       serial.lo
  CC       plugin.lo
../../../src/libosmocore/src/socket.c: In function ‘osmo_sock_unix_init’:
../../../src/libosmocore/src/socket.c:599:2: error: ‘strncpy’ specified bound 108 equals destination size [-Werror=stringop-truncation]
  strncpy(local.sun_path, socket_path, sizeof(local.sun_path));
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[4]: *** [Makefile:548: socket.lo] Error 1
make[4]: *** Waiting for unfinished jobs....
make[4]: Leaving directory '/n/s/dev/make/libosmocore/src'
make[3]: *** [Makefile:645: check] Error 2
make[3]: Leaving directory '/n/s/dev/make/libosmocore/src'
make[2]: *** [Makefile:604: check-recursive] Error 1
make[2]: Leaving directory '/n/s/dev/make/libosmocore'
make[1]: *** [Makefile:895: check] Error 2
make[1]: Leaving directory '/n/s/dev/make/libosmocore'
make: *** [Makefile:93: .make.libosmocore.build] Error 2

History

#1 Updated by neels 5 months ago

  • Status changed from New to In Progress
  • Assignee set to neels

more:

../../../../src/libosmocore/src/gsm/ipa.c: In function ‘ipa_ccm_make_id_resp’:
../../../../src/libosmocore/src/gsm/ipa.c:266:5: error: ‘strncpy’ specified bound 64 equals destination size [-Werror=stringop-truncation]
     strncpy(str, dev->swversion, IPA_STRING_MAX);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../src/libosmocore/src/gsm/ipa.c:262:5: error: ‘strncpy’ specified bound 64 equals destination size [-Werror=stringop-truncation]
     strncpy(str, dev->equipvers, IPA_STRING_MAX);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../src/libosmocore/src/gsm/ipa.c:258:5: error: ‘strncpy’ specified bound 64 equals destination size [-Werror=stringop-truncation]
     strncpy(str, dev->location2, IPA_STRING_MAX);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../src/libosmocore/src/gsm/ipa.c:254:5: error: ‘strncpy’ specified bound 64 equals destination size [-Werror=stringop-truncation]
     strncpy(str, dev->location1, IPA_STRING_MAX);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../src/libosmocore/src/gsm/ipa.c:281:5: error: ‘strncpy’ specified bound 64 equals destination size [-Werror=stringop-truncation]
     strncpy(str, dev->serno, IPA_STRING_MAX);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

#2 Updated by neels 5 months ago

In function ‘verify_pin.constprop’,
    inlined from ‘main’ at ../../../src/libosmocore/utils/osmo-sim-test.c:358:2:
../../../src/libosmocore/utils/osmo-sim-test.c:77:2: error: ‘strncpy’ output truncated before terminating nul copying 4 bytes from a string of the same length [-Werror=stringop-truncation]
  strncpy(pindst, pin, strlen(pin));
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#3 Updated by neels 5 months ago

actually strncpy(pindst, pin, strlen(pin)); is on purpose, it verify_pin() wants to omit the terminating nul

#5 Updated by neels 3 months ago

  • Status changed from In Progress to Resolved
  • % Done changed from 90 to 100

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)