Mercurial > gftp.yaz
changeset 798:d59f62126c97
2006-8-8 Brian Masney <masneyb@gftp.org>
* lib/protocols.c (gftp_parse_ls_unix) - fixes whenever a smaller than
expected attribute field is returned (gftp_get_line) - make sure the
end of the buffer is nul terminated properly
author | masneyb |
---|---|
date | Wed, 09 Aug 2006 00:31:06 +0000 |
parents | d7ec8202dba1 |
children | fce9ab76609d |
files | ChangeLog lib/protocols.c |
diffstat | 2 files changed, 19 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Aug 07 20:54:15 2006 +0000 +++ b/ChangeLog Wed Aug 09 00:31:06 2006 +0000 @@ -1,3 +1,8 @@ +2006-8-8 Brian Masney <masneyb@gftp.org> + * lib/protocols.c (gftp_parse_ls_unix) - fixes whenever a smaller than + expected attribute field is returned (gftp_get_line) - make sure the + end of the buffer is nul terminated properly + 2006-8-2 Brian Masney <masneyb@gftp.org> * src/gtk/misc-gtk.c (MakeYesNoDialog, MakeEditDialog) - use gtk_grab_add() to make sure these dialogs have exclusive focus in @@ -3532,7 +3537,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.464 2006/08/02 23:14:36 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.465 2006/08/09 00:31:05 masneyb Exp $ tags * debian/* - updated files from Debian maintainer
--- a/lib/protocols.c Mon Aug 07 20:54:15 2006 +0000 +++ b/lib/protocols.c Wed Aug 09 00:31:06 2006 +0000 @@ -1630,6 +1630,9 @@ if ((startpos = copy_token (&attribs, startpos)) == NULL) return (GFTP_EFATAL); + if (strlen (attribs) < 10) + return (GFTP_EFATAL); + fle->st_mode = gftp_convert_attributes_to_mode_t (attribs); g_free (attribs); @@ -2591,7 +2594,7 @@ /* This is not an overflow since we allocated one extra byte to buffer above */ - ((*rbuf)->curpos)[nslen] = '\0'; + ((*rbuf)->buffer)[nslen] = '\0'; } strncpy (str, (*rbuf)->curpos, len); @@ -2625,14 +2628,16 @@ if ((*rbuf)->eof) ret = 0; else - ret = read_function (request, pos, rlen, fd); - - if (ret < 0) { - gftp_free_getline_buffer (rbuf); - return (ret); + ret = read_function (request, pos, rlen, fd); + if (ret < 0) + { + gftp_free_getline_buffer (rbuf); + return (ret); + } } - else if (ret == 0) + + if (ret == 0) { if ((*rbuf)->cur_bufsize == 0) { @@ -2644,7 +2649,7 @@ } (*rbuf)->cur_bufsize += ret; - (*rbuf)->curpos[(*rbuf)->cur_bufsize] = '\0'; + (*rbuf)->buffer[(*rbuf)->cur_bufsize] = '\0'; } }