From: Zbigniew Jędrzejewski-Szmek Date: Thu, 28 Mar 2013 03:16:32 +0000 (-0400) Subject: catalog: make sure strings are terminated X-Git-Tag: v201~163 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;ds=sidebyside;h=18cd5fe99f70a55a2d6f2303d6ee0624942695b1;hp=18cd5fe99f70a55a2d6f2303d6ee0624942695b1;p=elogind.git 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. ---