diff options
author | Karel Zak | 2018-05-28 12:30:34 +0200 |
---|---|---|
committer | Karel Zak | 2018-05-28 12:30:34 +0200 |
commit | 64af1a29871e116ebf825fe8d4dbf1c1c73ce4a8 (patch) | |
tree | 4ee9041de3327c2c83a5ecd5ea01596628eda58f /lib | |
parent | Merge branch 'master' of https://github.com/pali/util-linux (diff) | |
download | kernel-qcow2-util-linux-64af1a29871e116ebf825fe8d4dbf1c1c73ce4a8.tar.gz kernel-qcow2-util-linux-64af1a29871e116ebf825fe8d4dbf1c1c73ce4a8.tar.xz kernel-qcow2-util-linux-64af1a29871e116ebf825fe8d4dbf1c1c73ce4a8.zip |
lib/strutils: fix strnlen() fallback
Addresses: https://github.com/karelzak/util-linux/issues/643
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/strutils.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/strutils.c b/lib/strutils.c index 74d2e5aa9..c3c422216 100644 --- a/lib/strutils.c +++ b/lib/strutils.c @@ -243,11 +243,11 @@ void *mempcpy(void *restrict dest, const void *restrict src, size_t n) #ifndef HAVE_STRNLEN size_t strnlen(const char *s, size_t maxlen) { - int i; + size_t i; for (i = 0; i < maxlen; i++) { if (s[i] == '\0') - return i + 1; + return i; } return maxlen; } |