summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-06-21 01:01:15 +0000
committerJeremy Allison <jra@samba.org>2001-06-21 01:01:15 +0000
commitfda0f83d751a1ea6c731fd6a82484a724a1c6e32 (patch)
tree9238fa62898b269583cbf5f6c0774cbd1ef6702b /source3/libsmb
parent3f1254bee1b3cc8cce1e17be6f0250090f579417 (diff)
downloadsamba-fda0f83d751a1ea6c731fd6a82484a724a1c6e32.tar.gz
samba-fda0f83d751a1ea6c731fd6a82484a724a1c6e32.tar.bz2
samba-fda0f83d751a1ea6c731fd6a82484a724a1c6e32.zip
Following info from TAKAHASHI Motonobu <monyo@samba.gr.jp>,
Samba Users Group Japan, ensure that we don't use dos_to_unix(xx,True), but always use dos_to_unix(xx,False) to prevent overwriting. Jeremy. (This used to be commit 244aec8ea623fec828add3ab09c5003bf32bd5c7)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/clirap.c17
-rw-r--r--source3/libsmb/clistr.c6
2 files changed, 15 insertions, 8 deletions
diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c
index 5d41af13f9..5050caf073 100644
--- a/source3/libsmb/clirap.c
+++ b/source3/libsmb/clirap.c
@@ -179,9 +179,12 @@ int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, co
int type = SVAL(p,14);
int comment_offset = IVAL(p,16) & 0xFFFF;
char *cmnt = comment_offset?(rdata+comment_offset-converter):"";
- dos_to_unix(sname,True);
- dos_to_unix(cmnt,True);
- fn(sname, type, cmnt, state);
+ pstring s1, s2;
+
+ pstrcpy(s1, dos_to_unix(sname, False));
+ pstrcpy(s2, dos_to_unix(cmnt, False));
+
+ fn(s1, type, s2, state);
}
} else {
DEBUG(4,("NetShareEnum res=%d\n", res));
@@ -256,13 +259,15 @@ BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
char *sname = p;
int comment_offset = (IVAL(p,22) & 0xFFFF)-converter;
char *cmnt = comment_offset?(rdata+comment_offset):"";
+ pstring s1, s2;
+
if (comment_offset < 0 || comment_offset > rdrcnt) continue;
stype = IVAL(p,18) & ~SV_TYPE_LOCAL_LIST_ONLY;
- dos_to_unix(sname, True);
- dos_to_unix(cmnt, True);
- fn(sname, stype, cmnt, state);
+ pstrcpy(s1, dos_to_unix(sname, False));
+ pstrcpy(s2, dos_to_unix(cmnt, False));
+ fn(s1, stype, s2, state);
}
}
}
diff --git a/source3/libsmb/clistr.c b/source3/libsmb/clistr.c
index 0225797538..887b5e84c1 100644
--- a/source3/libsmb/clistr.c
+++ b/source3/libsmb/clistr.c
@@ -112,7 +112,8 @@ int clistr_pull(struct cli_state *cli, char *dest, const void *src, int dest_len
memcpy(dest, src, len);
dest[len] = 0;
}
- if (flags & STR_CONVERT) dos_to_unix(dest,True);
+ if (flags & STR_CONVERT)
+ safe_strcpy(dest,dos_to_unix(dest,False),dest_len);
return len;
}
@@ -129,7 +130,8 @@ int clistr_pull(struct cli_state *cli, char *dest, const void *src, int dest_len
*dest++ = 0;
len = src_len;
}
- if (flags & STR_CONVERT) dos_to_unix(dest,True);
+ if (flags & STR_CONVERT)
+ safe_strcpy(dest,dos_to_unix(dest,False),dest_len);
return len;
}