X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=amar-src%2Famar.c;h=67cc109ac7e0492df4e3931cda45fedee1640f51;hb=8eb7e8e19f1373f6be7f1f7837b997748ce31d0e;hp=a39854da06b37685b191f1af01d694f005e76582;hpb=2627875b7d18858bc1f9f7652811e4d8c15a23eb;p=debian%2Famanda diff --git a/amar-src/amar.c b/amar-src/amar.c index a39854d..67cc109 100644 --- a/amar-src/amar.c +++ b/amar-src/amar.c @@ -1,21 +1,21 @@ /* - * Copyright (c) Zmanda, Inc. All Rights Reserved. + * Copyright (c) 2008,2009 Zmanda, Inc. All Rights Reserved. * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License version 2.1 - * as published by the Free Software Foundation. + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. * - * This library is distributed in the hope that it will be useful, but + * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300 - * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com + * Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300 + * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com */ #include "amanda.h" @@ -902,6 +902,22 @@ amar_read( } if (!datasize) { + unsigned int i, nul_padding = 1; + char *bb; + /* try to detect NULL padding bytes */ + if (!buf_atleast(archive, &hp, 512 - RECORD_SIZE)) { + /* close to end of file */ + break; + } + bb = buf_ptr(&hp); + /* check all byte == 0 */ + for (i=0; i<512 - RECORD_SIZE; i++) { + if (*bb++ != 0) + nul_padding = 0; + } + if (nul_padding) { + break; + } g_set_error(error, amar_error_quark(), EINVAL, "Archive file %d has an empty filename", (int)filenum);