config: don't pass -1 to mbstowcs(), silences linker(?) warning

'n' _is_ ignored when 'dest' is NULL, but you can still get the
following warning:

    In function ‘mbstowcs’,
        inlined from ‘parse_section_scrollback’ at ../config.c:429:26:
    /usr/include/bits/stdlib.h:129:10: warning: ‘__mbstowcs_alias’ specified size 18446744073709551612 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
      129 |   return __mbstowcs_alias (__dst, __src, __len);

To silence this warning, pass 0 instead, since it is ignored anyway.
This commit is contained in:
Daniel Eklöf 2020-08-22 10:56:53 +02:00
parent 11cb08f1b5
commit 82e197072b
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -426,9 +426,11 @@ parse_section_scrollback(const char *key, const char *value, struct config *conf
free(conf->scrollback.indicator.text);
conf->scrollback.indicator.text = NULL;
size_t len = mbstowcs(NULL, value, -1);
size_t len = mbstowcs(NULL, value, 0);
if (len < 0) {
LOG_AND_NOTIFY_ERRNO("%s:%d: [scrollback]: indicator-format: invalid value: %s", path, lineno, value);
LOG_AND_NOTIFY_ERRNO(
"%s:%d: [scrollback]: indicator-format: "
"invalid value: %s", path, lineno, value);
return false;
}