# HG changeset patch # User Mike Becker # Date 1526469213 -7200 # Node ID ebae0e434898aa88216bfdcd34830d37871d6a76 # Parent be0f6bd10b52c6de07f631f2b289be356f56c3dc overflow of sstrnlen should return SIZE_MAX instead of zero diff -r be0f6bd10b52 -r ebae0e434898 src/string.c --- a/src/string.c Mon May 14 19:24:34 2018 +0200 +++ b/src/string.c Wed May 16 13:13:33 2018 +0200 @@ -73,8 +73,8 @@ for (size_t i = 0 ; i < n ; i++) { scstr_t str = va_arg(ap, scstr_t); - if(((size_t)-1) - str.length < size) { - size = 0; + if(SIZE_MAX - str.length < size) { + size = SIZE_MAX; break; } size += str.length;