Skip to content

Commit

Permalink
Increase buffer size to avoid the (theoretical) possibility of trunca…
Browse files Browse the repository at this point in the history
…tion,

and a warning.


git-svn-id: https://svn.r-project.org/R/trunk@85676 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
kalibera committed Dec 13, 2023
1 parent a811921 commit 0a11d6c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/character.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ static void substr(const char *str, int len, int ienc, int sa, int so,

if (ienc == CE_UTF8) {
if (!assumevalid && !utf8Valid(str)) {
char msg[30];
snprintf(msg, 30, "element %ld", (long)idx+1);
char msg[40];
snprintf(msg, 40, "element %ld", (long)idx+1);
error(_("invalid multibyte string, %s"), msg);
}
for (i = 0; i < sa - 1 && str < end; i++)
Expand Down Expand Up @@ -588,13 +588,13 @@ substrset(char *buf, const char *const str, cetype_t ienc, int sa, int so,

if (ienc == CE_UTF8) {
if (!utf8Valid(buf)) {
char msg[30];
snprintf(msg, 30, "element %ld", (long)xidx+1);
char msg[40];
snprintf(msg, 40, "element %ld", (long)xidx+1);
error(_("invalid multibyte string, %s"), msg);
}
if (!utf8Valid(str)) {
char msg[30];
snprintf(msg, 30, "value element %ld", (long)vidx+1);
char msg[40];
snprintf(msg, 40, "value element %ld", (long)vidx+1);
error(_("invalid multibyte string, %s"), msg);
}
for (i = 1; i < sa; i++) buf += utf8clen(*buf);
Expand Down

0 comments on commit 0a11d6c

Please sign in to comment.