Skip to content

Snprintf fix

John Douglas Veitch requested to merge john-veitch/lalsuite:snprintf_fix into master

Description

The build was broken on Debian 10 (buster) with gcc (Debian 8.3.0-6) 8.3.0. The error is due to a miscalculation of string length:

  CC       PulsarSimulateCoherentGW.lo
PulsarSimulateCoherentGW.c: In function ‘LALPulsarSimulateCoherentGW’:
PulsarSimulateCoherentGW.c:404:9: error: ‘snprintf’ output truncated before the last format character [-Werror=format-truncation=]
     if (snprintf( output->name, LALNameLength, "response to %*s", LALNameLength - 12, CWsignal->a->name ) >= LALNameLength ) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PulsarSimulateCoherentGW.c:404:9: note: ‘snprintf’ output between 65 and 76 bytes into a destination of size 64
cc1: all warnings being treated as errors

The 12 should be a 13.

API Changes and Justification

Backwards Compatible Changes

  • This change introduces no API changes
  • This change adds new API calls

Backwards Incompatible Changes

  • This change modifies an existing API
  • This change removes an existing API

Review Status

Edited by Karl Wette

Merge request reports

Loading