svn commit: samba r2609 - in trunk/source/lib: .

jra at samba.org jra at samba.org
Fri Sep 24 23:56:16 GMT 2004


Author: jra
Date: 2004-09-24 23:56:16 +0000 (Fri, 24 Sep 2004)
New Revision: 2609

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/trunk/source/lib&rev=2609&nolog=1

Log:
Even if we only use the fast-path (ascii only) then
we still need to set errno = E2BIG when we overflow.
Jeremy.

Modified:
   trunk/source/lib/charcnv.c


Changeset:
Modified: trunk/source/lib/charcnv.c
===================================================================
--- trunk/source/lib/charcnv.c	2004-09-24 20:37:53 UTC (rev 2608)
+++ trunk/source/lib/charcnv.c	2004-09-24 23:56:16 UTC (rev 2609)
@@ -394,6 +394,13 @@
 #endif
 			}
 		}
+		if (!dlen) {
+			/* Even if we fast path we should note if we ran out of room. */
+			if (((slen != (size_t)-1) && slen) ||
+					((slen == (size_t)-1) && lastp)) {
+				errno = E2BIG;
+			}
+		}
 		return retval;
 	} else if (from == CH_UCS2 && to != CH_UCS2) {
 		const unsigned char *p = (const unsigned char *)src;
@@ -423,6 +430,13 @@
 #endif
 			}
 		}
+		if (!dlen) {
+			/* Even if we fast path we should note if we ran out of room. */
+			if (((slen != (size_t)-1) && slen) ||
+					((slen == (size_t)-1) && lastp)) {
+				errno = E2BIG;
+			}
+		}
 		return retval;
 	} else if (from != CH_UCS2 && to == CH_UCS2) {
 		const unsigned char *p = (const unsigned char *)src;
@@ -452,6 +466,13 @@
 #endif
 			}
 		}
+		if (!dlen) {
+			/* Even if we fast path we should note if we ran out of room. */
+			if (((slen != (size_t)-1) && slen) ||
+					((slen == (size_t)-1) && lastp)) {
+				errno = E2BIG;
+			}
+		}
 		return retval;
 	}
 



More information about the samba-cvs mailing list