summaryrefslogtreecommitdiff
path: root/src/shared/strxcpyx.h
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-27 23:16:32 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-28 23:45:59 -0400
commit18cd5fe99f70a55a2d6f2303d6ee0624942695b1 (patch)
tree8eff0d48a233db8ee6876471dae9c54440059045 /src/shared/strxcpyx.h
parentf45928521249bbaf5dbea84933ae2fcaf5354080 (diff)
catalog: make sure strings are terminated
Coverity complains: systemd-199/src/journal/catalog.c:126: buffer_size_warning: Calling strncpy with a maximum size argument of 32 bytes on destination array "i->language" of size 32 bytes might leave the destination string unterminated. ...and unfortunately it was right. The string was defined as a fixed-size string in some parts of the code, and used a null-terminated string in others (e.g. in log statements). There's no point in conserving one byte, so just define the max language tag length to 31 bytes, and use null terminated strings everywhere. Also, wrap some lines, zero-fill less bytes, use '\0' instead of just 0 to be more explicit that this is one byte.
Diffstat (limited to 'src/shared/strxcpyx.h')
0 files changed, 0 insertions, 0 deletions