ibarwick / fbsql

fbsql is a simple command-line client for the Firebird database, inspired by PostgreSQL's psql
10 stars 0 forks source link

strncpy warnings #4

Closed mkgrgis closed 1 year ago

mkgrgis commented 1 year ago
command.c: In function ‘_wildcard_pattern_clause’:
command.c:557:3: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
  557 |   strncpy(like_pattern, pattern, pattern_len - 1);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
command.c:546:23: note: length computed here
  546 |  size_t pattern_len = strlen(pattern);
      |                       ^~~~~~~~~~~~~~~
In function ‘_listIndexSegments’,
    inlined from ‘describeTable’ at command.c:868:21,
    inlined from ‘describeObject’ at command.c:769:5,
    inlined from ‘execSlashCommand’ at command.c:317:4,
    inlined from ‘HandleSlashCmds’ at command.c:121:11:
command.c:1518:2: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
 1518 |  strncpy(result, buf.data, strlen(buf.data) + 1);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
command.c: In function ‘HandleSlashCmds’:
command.c:1518:28: note: length computed here
 1518 |  strncpy(result, buf.data, strlen(buf.data) + 1);
      | 
ibarwick commented 1 year ago

Fixed, thanks.