(grub_size_t) -1 is never returned, the function always return
a not negative values. This is important for overflows considerations.

Signed-off-by: Frediano Ziglio <frediano.zig...@cloud.com>
Reviewed-by: Daniel Kiper <dki...@net-space.pl>
---
 include/grub/charset.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/grub/charset.h b/include/grub/charset.h
index 31a3b52dd..df79aae53 100644
--- a/include/grub/charset.h
+++ b/include/grub/charset.h
@@ -117,7 +117,8 @@ grub_utf8_process (grub_uint8_t c, grub_uint32_t *code, int 
*count)
 /* Convert a (possibly null-terminated) UTF-8 string of at most SRCSIZE
    bytes (if SRCSIZE is -1, it is ignored) in length to a UTF-16 string.
    Return the number of characters converted. DEST must be able to hold
-   at least DESTSIZE characters. If an invalid sequence is found, return -1.
+   at least DESTSIZE characters. If an invalid sequence is found, it is
+   replaced by a question mark ('?').
    If SRCEND is not NULL, then *SRCEND is set to the next byte after the
    last byte used in SRC.  */
 static inline grub_size_t
-- 
2.49.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to