diff options
author | Ken Raeburn <raeburn@mit.edu> | 1998-04-22 01:30:40 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@mit.edu> | 1998-04-22 01:30:40 +0000 |
commit | 278108fdc7c7b4b14f0eec6bb31ad426e292aec2 (patch) | |
tree | 97e113450ec1e5a007c795dc7d530b0b4494e213 /src/appl/gssftp | |
parent | bb19c517943cebf1e408a43051e044144545a5c4 (diff) | |
download | krb5-278108fdc7c7b4b14f0eec6bb31ad426e292aec2.zip krb5-278108fdc7c7b4b14f0eec6bb31ad426e292aec2.tar.gz krb5-278108fdc7c7b4b14f0eec6bb31ad426e292aec2.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.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10539 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/appl/gssftp')
-rw-r--r-- | src/appl/gssftp/ftp/ChangeLog | 6 | ||||
-rw-r--r-- | src/appl/gssftp/ftp/glob.c | 13 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/appl/gssftp/ftp/ChangeLog b/src/appl/gssftp/ftp/ChangeLog index 9fbe76b..f56f598 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; |