diff options
-rw-r--r-- | include/c/str/cpy/stp/stpe/ustr2stpe.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/include/c/str/cpy/stp/stpe/ustr2stpe.h b/include/c/str/cpy/stp/stpe/ustr2stpe.h index a4424b8..87c2065 100644 --- a/include/c/str/cpy/stp/stpe/ustr2stpe.h +++ b/include/c/str/cpy/stp/stpe/ustr2stpe.h @@ -36,9 +36,8 @@ c_ustr2stpe(char *c_nullable dst, char *end, const char *restrict src, c_impossible(dst > end); dsize = end - dst; - slen = MIN(slen, dsize); - trunc = (slen == dsize); - dlen = slen - trunc; + trunc = (slen > dsize - 1); + dlen = MIN(slen, dsize - 1); dst[dlen] = '\0'; return c_mempcpy(dst, src, dlen) + trunc; |