svn commit: samba r25277 - in branches: SAMBA_3_2/source/lib
SAMBA_3_2_0/source/lib
jra at samba.org
jra at samba.org
Fri Sep 21 10:32:58 GMT 2007
Author: jra
Date: 2007-09-21 10:32:57 +0000 (Fri, 21 Sep 2007)
New Revision: 25277
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25277
Log:
Belt-and-braces approach to Volker's fix for RPC-SAMBA3-GETUSERNAME.
If we promise dest is null terminated, ensure we do it even on
fast path exits.
Jeremy.
Modified:
branches/SAMBA_3_2/source/lib/charcnv.c
branches/SAMBA_3_2_0/source/lib/charcnv.c
Changeset:
Modified: branches/SAMBA_3_2/source/lib/charcnv.c
===================================================================
--- branches/SAMBA_3_2/source/lib/charcnv.c 2007-09-21 10:32:12 UTC (rev 25276)
+++ branches/SAMBA_3_2/source/lib/charcnv.c 2007-09-21 10:32:57 UTC (rev 25277)
@@ -1403,15 +1403,18 @@
{
size_t ret;
- if (!src_len) {
- return 0;
- }
-
if (dest_len == (size_t)-1) {
/* No longer allow dest_len of -1. */
smb_panic("pull_ucs2 - invalid dest_len of -1");
}
+ if (!src_len) {
+ if (dest && dest_len > 0) {
+ dest[0] = '\0';
+ }
+ return 0;
+ }
+
if (ucs2_align(base_ptr, src, flags)) {
src = (const void *)((const char *)src + 1);
if (src_len != (size_t)-1)
Modified: branches/SAMBA_3_2_0/source/lib/charcnv.c
===================================================================
--- branches/SAMBA_3_2_0/source/lib/charcnv.c 2007-09-21 10:32:12 UTC (rev 25276)
+++ branches/SAMBA_3_2_0/source/lib/charcnv.c 2007-09-21 10:32:57 UTC (rev 25277)
@@ -1403,15 +1403,18 @@
{
size_t ret;
- if (!src_len) {
- return 0;
- }
-
if (dest_len == (size_t)-1) {
/* No longer allow dest_len of -1. */
smb_panic("pull_ucs2 - invalid dest_len of -1");
}
+ if (!src_len) {
+ if (dest && dest_len > 0) {
+ dest[0] = '\0';
+ }
+ return 0;
+ }
+
if (ucs2_align(base_ptr, src, flags)) {
src = (const void *)((const char *)src + 1);
if (src_len != (size_t)-1)
More information about the samba-cvs
mailing list