aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Yu <tlyu@mit.edu>1998-04-22 02:07:32 +0000
committerTom Yu <tlyu@mit.edu>1998-04-22 02:07:32 +0000
commita503ef117f9201e7ba63834d05bdd3c4d0eea64b (patch)
treed10bd52231d880780250d5598f82f4c077e798e4
parentc5270c81e2187be9e7c0fccb532620d47539aa7f (diff)
downloadkrb5-a503ef117f9201e7ba63834d05bdd3c4d0eea64b.zip
krb5-a503ef117f9201e7ba63834d05bdd3c4d0eea64b.tar.gz
krb5-a503ef117f9201e7ba63834d05bdd3c4d0eea64b.tar.bz2
* glob.c (ftpglob): Always allocate new storage, even if no magic
glob characters were found, because the caller will always free the storage. [pullup from trunk] git-svn-id: svn://anonsvn.mit.edu/krb5/branches/V1_0_BRANCH@10540 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r--src/appl/gssftp/ftp/ChangeLog6
-rw-r--r--src/appl/gssftp/ftp/glob.c13
2 files changed, 17 insertions, 2 deletions
diff --git a/src/appl/gssftp/ftp/ChangeLog b/src/appl/gssftp/ftp/ChangeLog
index aa7a1f7..12e1741 100644
--- a/src/appl/gssftp/ftp/ChangeLog
+++ b/src/appl/gssftp/ftp/ChangeLog
@@ -1,3 +1,9 @@
+1998-04-21 Ken Raeburn <raeburn@cygnus.com>
+
+ * glob.c (ftpglob): Always allocate new storage, even if no magic
+ glob characters were found, because the caller will always free
+ the storage.
+
Tue Apr 7 16:53:58 1998 Dan Winship <danw@mit.edu>
* secure.c (secure_putbyte): Set nout = 0 *before* calling
diff --git a/src/appl/gssftp/ftp/glob.c b/src/appl/gssftp/ftp/glob.c
index 3a793d8..f92ee5e 100644
--- a/src/appl/gssftp/ftp/glob.c
+++ b/src/appl/gssftp/ftp/glob.c
@@ -104,8 +104,17 @@ ftpglob(v)
vv[1] = 0;
gflag = 0;
rscan(vv, tglob);
- if (gflag == 0)
- return (copyblk(vv));
+ if (gflag == 0) {
+ /* Caller will always free the contents, so make a copy. */
+ size_t len = strlen (v) + 1;
+ vv[0] = malloc (len);
+ if (vv[0] == 0) {
+ globerr = "Can't allocate memory";
+ return 0;
+ }
+ memcpy (vv[0], v, len);
+ return (copyblk(vv));
+ }
globerr = 0;
gpath = agpath; gpathp = gpath; *gpathp = 0;