summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-01-11 12:04:14 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-01-11 12:04:14 +0000
commit73b0a2bdf8b667a5ad70bb4bcc08409e8c9ef7aa (patch)
treeb5a056ba7516c5b4f5073b8a98338b82ff57afe2 /source3/libsmb
parent22d6569ed514bac025958d6cfdc99ec472a3f5cb (diff)
downloadsamba-73b0a2bdf8b667a5ad70bb4bcc08409e8c9ef7aa.tar.gz
samba-73b0a2bdf8b667a5ad70bb4bcc08409e8c9ef7aa.tar.bz2
samba-73b0a2bdf8b667a5ad70bb4bcc08409e8c9ef7aa.zip
Fix a number of client-side fstring/pstring mixups.
Andrew Bartlett (This used to be commit fe1cc779d5ea77e87dbc0e2edf7c34a354fee6e0)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/clilist.c8
-rw-r--r--source3/libsmb/smbencrypt.c18
2 files changed, 14 insertions, 12 deletions
diff --git a/source3/libsmb/clilist.c b/source3/libsmb/clilist.c
index 4a1737af49..89ab5d6414 100644
--- a/source3/libsmb/clilist.c
+++ b/source3/libsmb/clilist.c
@@ -324,9 +324,11 @@ static int interpret_short_filename(struct cli_state *cli, char *p,file_info *fi
finfo->mtime = finfo->atime = finfo->ctime;
finfo->size = IVAL(p,26);
clistr_pull(cli, finfo->name, p+30, sizeof(finfo->name), 12, STR_ASCII);
- if (strcmp(finfo->name, "..") && strcmp(finfo->name, "."))
- fstrcpy(finfo->short_name,finfo->name);
-
+ if (strcmp(finfo->name, "..") && strcmp(finfo->name, ".")) {
+ strncpy(finfo->short_name,finfo->name, sizeof(finfo->short_name)-1);
+ finfo->short_name[sizeof(finfo->short_name)-1] = '\0';
+ }
+
return(DIR_STRUCT_SIZE);
}
diff --git a/source3/libsmb/smbencrypt.c b/source3/libsmb/smbencrypt.c
index 42250fc19c..06871104a4 100644
--- a/source3/libsmb/smbencrypt.c
+++ b/source3/libsmb/smbencrypt.c
@@ -122,33 +122,33 @@ BOOL ntv2_owf_gen(const uchar owf[16],
smb_ucs2_t *user;
smb_ucs2_t *domain;
- int user_byte_len;
- int domain_byte_len;
+ size_t user_byte_len;
+ size_t domain_byte_len;
HMACMD5Context ctx;
user_byte_len = push_ucs2_allocate(&user, user_in);
- if (user_byte_len < 0) {
- DEBUG(0, ("push_ucs2_allocate() for user returned %d (probably malloc() failure)\n", user_byte_len));
+ if (user_byte_len == (size_t)-1) {
+ DEBUG(0, ("push_uss2_allocate() for user returned -1 (probably malloc() failure)\n"));
return False;
}
domain_byte_len = push_ucs2_allocate(&domain, domain_in);
- if (domain_byte_len < 0) {
- DEBUG(0, ("push_ucs2_allocate() for domain returned %d (probably malloc() failure)\n", domain_byte_len));
+ if (domain_byte_len == (size_t)-1) {
+ DEBUG(0, ("push_uss2_allocate() for domain returned -1 (probably malloc() failure)\n"));
return False;
}
strupper_w(user);
strupper_w(domain);
+ SMB_ASSERT(user_byte_len >= 2);
+ SMB_ASSERT(domain_byte_len >= 2);
+
/* We don't want null termination */
user_byte_len = user_byte_len - 2;
domain_byte_len = domain_byte_len - 2;
- SMB_ASSERT(user_byte_len >= 0);
- SMB_ASSERT(domain_byte_len >= 0);
-
hmac_md5_init_limK_to_64(owf, 16, &ctx);
hmac_md5_update((const unsigned char *)user, user_byte_len, &ctx);
hmac_md5_update((const unsigned char *)domain, domain_byte_len, &ctx);