Pass paste buffer through vis(3) when pasting to prevent buffers

containing for example the bracket end sequence causing issues. -S flag
disables. Reported by Mason Davis.
This commit is contained in:
nicm
2026-02-25 07:53:41 +00:00
parent bd6e201926
commit 5b3c642195
4 changed files with 40 additions and 16 deletions

10
utf8.c
View File

@@ -639,7 +639,7 @@ utf8_append(struct utf8_data *ud, u_char ch)
* bytes available for each character from src (for \abc or UTF-8) plus space
* for \0.
*/
int
size_t
utf8_strvis(char *dst, const char *src, size_t len, int flag)
{
struct utf8_data ud;
@@ -677,11 +677,11 @@ utf8_strvis(char *dst, const char *src, size_t len, int flag)
}
/* Same as utf8_strvis but allocate the buffer. */
int
size_t
utf8_stravis(char **dst, const char *src, int flag)
{
char *buf;
int len;
size_t len;
buf = xreallocarray(NULL, 4, strlen(src) + 1);
len = utf8_strvis(buf, src, strlen(src), flag);
@@ -691,11 +691,11 @@ utf8_stravis(char **dst, const char *src, int flag)
}
/* Same as utf8_strvis but allocate the buffer. */
int
size_t
utf8_stravisx(char **dst, const char *src, size_t srclen, int flag)
{
char *buf;
int len;
size_t len;
buf = xreallocarray(NULL, 4, srclen + 1);
len = utf8_strvis(buf, src, srclen, flag);