[PATCH] Remove code limiting buffer size.

Thomas Klausner wiz at NetBSD.org
Sun Jun 2 16:28:31 PDT 2013


Remove code that truncates the source length to the destination
length if it is larger. Seems useless to do that since the code
tests for both source length and destination to be non-zero. This
fixes cut-n-paste problem in xterm where the paste length was
limited to 1024 (BUFSIZ) in button.c
---
 modules/lc/gen/lcGenConv.c | 29 -----------------------------
 1 file changed, 29 deletions(-)

diff --git a/modules/lc/gen/lcGenConv.c b/modules/lc/gen/lcGenConv.c
index 42d63c5..f051b8d 100644
--- a/modules/lc/gen/lcGenConv.c
+++ b/modules/lc/gen/lcGenConv.c
@@ -764,9 +764,6 @@ mbstowcs_org(
         return( 0 );
     }
 
-    if (*from_left > *to_left)
-        *from_left = *to_left;
-
     while (*from_left && *to_left) {
 
 	ch = *inbufptr++;
@@ -920,10 +917,6 @@ wcstombs_org(
     const char *default_string = XLC_PUBLIC(lcd, default_string);
     int defstr_len = strlen(default_string);
 
-
-    if (*from_left > *to_left)
-        *from_left = *to_left;
-
     while (*from_left && *to_left) {
 
         wc = *inbufptr++;
@@ -1080,9 +1073,6 @@ wcstocts(
     int from_size = *from_left;
     char *ext_seg_len = NULL;
 
-    if (*from_left > *to_left)
-        *from_left = *to_left;
-
     while (*from_left && *to_left) {
 
         wc = *inbufptr++;
@@ -1272,9 +1262,6 @@ ctstowcs(
         return( 0 );
     }
 
-    if (*from_left > *to_left)
-        *from_left = *to_left;
-
     while (*from_left && *to_left) {
 
 	ch = *inbufptr++;
@@ -1666,9 +1653,6 @@ mbstostr(
         return( 0 );
     }
 
-    if (*from_left > *to_left)
-        *from_left = *to_left;
-
     while (*from_left && *to_left) {
 
 	ch = *inbufptr++;
@@ -1956,10 +1940,6 @@ wcstostr(
     const char *default_string = XLC_PUBLIC(lcd, default_string);
     int defstr_len = strlen(default_string);
 
-
-    if (*from_left > *to_left)
-        *from_left = *to_left;
-
     while (*from_left && *to_left) {
 
         wc = *inbufptr++;
@@ -2114,9 +2094,6 @@ wctocs(
     char *outbufptr = *to;
     int from_size = *from_left;
 
-    if (*from_left > *to_left)
-        *from_left = *to_left;
-
     if (*from_left && *to_left) {
 
         wc = *inbufptr++;
@@ -2427,9 +2404,6 @@ strtombs(
     char *outbufptr = *to;
     int from_size = *from_left;
 
-    if (*from_left > *to_left)
-        *from_left = *to_left;
-
     while (*from_left && *to_left) {
 
         ch = *inbufptr++;
@@ -2537,9 +2511,6 @@ strtowcs(
     wchar_t *outbufptr = (wchar_t *)*to;
     int from_size = *from_left;
 
-    if (*from_left > *to_left)
-        *from_left = *to_left;
-
     while (*from_left && *to_left) {
 
         ch = *inbufptr++;
-- 
1.8.2.3



More information about the xorg-devel mailing list