summaryrefslogtreecommitdiff
path: root/source3/smbd/trans2.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-03-27 12:38:45 +0000
committerAndrew Tridgell <tridge@samba.org>2000-03-27 12:38:45 +0000
commit18bc76a0c6830358a137b4198e17b1b7ce92b9bf (patch)
tree80ddeebfb47c978607be5c708ec5e81d10b91d6a /source3/smbd/trans2.c
parent6570b48d73d4d6597cf8f17040cb57e8b16394dd (diff)
downloadsamba-18bc76a0c6830358a137b4198e17b1b7ce92b9bf.tar.gz
samba-18bc76a0c6830358a137b4198e17b1b7ce92b9bf.tar.bz2
samba-18bc76a0c6830358a137b4198e17b1b7ce92b9bf.zip
changed the definition of dos_PutUniCode
the previous definition could result is us overflowing a buffer. The null termination was always added yet the size returned did not include the null termination. the new function takes a BOOL null_terminate, and always returns the total number of bytes consumed by the string. (This used to be commit 426c90433396a95033eefcc4af97603abc934221)
Diffstat (limited to 'source3/smbd/trans2.c')
-rw-r--r--source3/smbd/trans2.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 308ba2dacd..24abf60a79 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -1179,7 +1179,7 @@ static int call_trans2qfsinfo(connection_struct *conn,
#endif /* Old code. */
SIVAL(pdata,4,128); /* Max filename component length */
- fstype_len = dos_PutUniCode(pdata+12,unix_to_dos(fstype,False),sizeof(pstring)/2);
+ fstype_len = dos_PutUniCode(pdata+12,unix_to_dos(fstype,False),sizeof(pstring), False);
SIVAL(pdata,8,fstype_len);
data_len = 12 + fstype_len;
SSVAL(outbuf,smb_flg2,SVAL(outbuf,smb_flg2)|FLAGS2_UNICODE_STRINGS);
@@ -1209,7 +1209,7 @@ static int call_trans2qfsinfo(connection_struct *conn,
} else {
data_len = 18 + 2*strlen(vname);
SIVAL(pdata,12,strlen(vname)*2);
- dos_PutUniCode(pdata+18,unix_to_dos(vname,False),sizeof(pstring)/2);
+ dos_PutUniCode(pdata+18,unix_to_dos(vname,False),sizeof(pstring), False);
}
DEBUG(5,("call_trans2qfsinfo : SMB_QUERY_FS_VOLUME_INFO namelen = %d, vol = %s\n",
@@ -1480,7 +1480,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
}
strupper(short_name);
l = strlen(short_name);
- dos_PutUniCode(pdata + 4, unix_to_dos(short_name,False),sizeof(pstring)*2);
+ dos_PutUniCode(pdata + 4, unix_to_dos(short_name,False),sizeof(pstring), False);
data_size = 4 + (2*l);
SIVAL(pdata,0,2*l);
}
@@ -1496,7 +1496,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
if(strequal(".", fname) && (global_client_caps & CAP_UNICODE)) {
l = l*2;
SSVAL(outbuf,smb_flg2,SVAL(outbuf,smb_flg2)|FLAGS2_UNICODE_STRINGS);
- dos_PutUniCode(pdata + 4, unix_to_dos("\\",False),sizeof(pstring)*2);
+ dos_PutUniCode(pdata + 4, unix_to_dos("\\",False),sizeof(pstring), False);
} else {
pstrcpy(pdata+4,fname);
}