]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libblkid: fix and cleanup blkid_safe_string()
authorKarel Zak <kzak@redhat.com>
Wed, 16 Jun 2021 08:46:40 +0000 (10:46 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 16 Jun 2021 08:58:11 +0000 (10:58 +0200)
commit66e259c746e5dc5db7ac6b67c98b0abbc2ab2e6c
tree08bb8fa7701db597cb0a7101a472809778a88a7b
parent8a3a74160b96498d672e3652827aa7e6d7f3a120
libblkid: fix and cleanup blkid_safe_string()

* Don't use 'size_t len' variable for utf8_encoded_valid_unichar()
  return code as it returns negative numbers on invalid utf8 sequence.

* Don't rely only on \0, but check the current position against output
  buffer size.

* Accept hex encoding like the original version.

* Use else-if to avoid unnecessary 'continue'.

Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/encode.c