NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/44858: CLI fails for the first time if the input character length is greater than 1024. From next time onwards it passes.
>Number: 44858
>Category: kern
>Synopsis: CLI fails for the first time if the input character length is
>greater than 1024. From next time onwards it passes.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Apr 12 05:40:00 +0000 2011
>Originator: Anoop
>Release: the one which supports utf-8 chars.
>Organization:
Citrix
>Environment:
FreeBSD BLR3V-02 6.3-RELEASE FreeBSD 6.3-RELEASE #0: Wed Jan 16 04:18:52 UTC
2008 root%dessler.cse.buffalo.edu@localhost:/usr/obj/usr/src/sys/GENERIC
i386
>Description:
If i enter a CLI whose length is more than 1024 chars, it fails for the first
time. From next time onwards it gracefully accepts that CLI.
This bug is in the netbsd version which supports UTF-8 chars.
The bug is in file chartype.c
>How-To-Repeat:
enter the CLI whose length is greater than 1024 chars.
For the first time it'll fail.
>Fix:
The bug is in file chartype.c
SNIP
----
ct_encode_string(const Char *s, ct_buffer_t *conv)
{
dst = conv->cbuff;
while (*s) {
used = ct_encode_char(dst, (int)(conv->csize -
(dst - conv->cbuff)), *s);
if (used == -1) { /* failed to encode, need more buffer space */
used = dst - conv->cbuff;
ct_conv_buff_resize(conv, conv->csize + CT_BUFSIZ, 0);
if (!conv->cbuff)
return NULL;
///anoop: Here dst pointer is incremented.
dst = conv->cbuff + used;
/* don't increment s here - we want to retry it! */
}
else
++s;
///anoop: dst pointer incremented again moving to wrong offset.
dst += used;
}
*dst = '\0';
return conv->cbuff;
}
------
A simple Fix is to modify else statement:
else {
++s;
dst = conv->cbuff + used;
}
Home |
Main Index |
Thread Index |
Old Index