Fix bug in stoucs(). Thanks to Andras Erdei.

(Logical change 1.281)
edge.strict_endians
cantab.net!aia21 2004-02-25 17:14:40 +00:00
parent 83a577b1e5
commit 536b80cb56
1 changed files with 4 additions and 2 deletions

View File

@ -567,8 +567,10 @@ int stoucs(uchar_t *dest, const char *src, int maxlen)
char c;
int i;
/* Need two bytes for null terminator. */
maxlen -= 2;
/* Convert maxlen from bytes to unicode characters. */
maxlen /= sizeof(uchar_t);
/* Need space for null terminator. */
maxlen--;
for (i = 0; i < maxlen; i++) {
c = src[i];
if (!c)