Avoid cutting in the middle of UTF-8 string.
* include/grub/charset.h (grub_getend): New function. * grub-core/script/function.c (grub_script_function_find): Use grub_getend. * grub-core/normal/completion.c (add_completion): Likewise.
This commit is contained in:
parent
f3cb4a4e57
commit
4d8c476536
4 changed files with 46 additions and 1 deletions
|
@ -26,6 +26,7 @@
|
|||
#include <grub/file.h>
|
||||
#include <grub/parser.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/charset.h>
|
||||
|
||||
/* The current word. */
|
||||
static const char *current_word;
|
||||
|
@ -86,6 +87,7 @@ add_completion (const char *completion, const char *extra,
|
|||
s++;
|
||||
t++;
|
||||
}
|
||||
s = match + grub_getend (match, s);
|
||||
|
||||
*s = '\0';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue