diff --git a/0001-remove-extra-carriage-returns.patch b/0001-remove-extra-carriage-returns.patch new file mode 100644 index 0000000..b591789 --- /dev/null +++ b/0001-remove-extra-carriage-returns.patch @@ -0,0 +1,483 @@ +From 651d87f20fa647139b8f969577d0391266d53288 Mon Sep 17 00:00:00 2001 +From: William Hubbs +Date: Thu, 11 Nov 2010 12:56:10 -0600 +Subject: [PATCH] remove extra carriage returns + +--- + src/readdir.c | 254 +++++++++++++++++++++++++------------------------- + src/readdir.h | 192 +++++++++++++++++++------------------- + 2 files changed, 223 insertions(+), 223 deletions(-) + +diff --git a/src/readdir.c b/src/readdir.c +index 3503ceb..df1f3f4 100644 +--- a/src/readdir.c ++++ b/src/readdir.c +@@ -1,138 +1,138 @@ +-/* ==================================================================== +- * The Apache Software License, Version 1.1 +- * +- * Copyright (c) 2000 The Apache Software Foundation. All rights +- * reserved. +- * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions +- * are met: +- * +- * 1. Redistributions of source code must retain the above copyright +- * notice, this list of conditions and the following disclaimer. +- * +- * 2. Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimer in +- * the documentation and/or other materials provided with the +- * distribution. +- * +- * 3. The end-user documentation included with the redistribution, +- * if any, must include the following acknowledgment: +- * "This product includes software developed by the +- * Apache Software Foundation (http://www.apache.org/)." +- * Alternately, this acknowledgment may appear in the software itself, +- * if and wherever such third-party acknowledgments normally appear. +- * +- * 4. The names "Apache" and "Apache Software Foundation" must +- * not be used to endorse or promote products derived from this +- * software without prior written permission. For written +- * permission, please contact apache@apache.org. +- * +- * 5. Products derived from this software may not be called "Apache", +- * nor may "Apache" appear in their name, without prior written +- * permission of the Apache Software Foundation. +- * +- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR +- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +- * SUCH DAMAGE. +- * ==================================================================== +- * +- * This software consists of voluntary contributions made by many +- * individuals on behalf of the Apache Software Foundation. For more +- * information on the Apache Software Foundation, please see +- * . +- * +- * Portions of this software are based upon public domain software +- * originally written at the National Center for Supercomputing Applications, +- * University of Illinois, Urbana-Champaign. +- */ +- +-#ifdef WIN32 +- +-#include +-#include +-#include +- +-#include "readdir.h" +- +-/********************************************************************** +- * Implement dirent-style opendir/readdir/closedir on Window 95/NT +- * +- * Functions defined are opendir(), readdir() and closedir() with the +- * same prototypes as the normal dirent.h implementation. +- * +- * Does not implement telldir(), seekdir(), rewinddir() or scandir(). +- * The dirent struct is compatible with Unix, except that d_ino is +- * always 1 and d_off is made up as we go along. +- * +- * The DIR typedef is not compatible with Unix. +- **********************************************************************/ +- DIR * opendir(const char *dir) ++/* ==================================================================== ++ * The Apache Software License, Version 1.1 ++ * ++ * Copyright (c) 2000 The Apache Software Foundation. All rights ++ * reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in ++ * the documentation and/or other materials provided with the ++ * distribution. ++ * ++ * 3. The end-user documentation included with the redistribution, ++ * if any, must include the following acknowledgment: ++ * "This product includes software developed by the ++ * Apache Software Foundation (http://www.apache.org/)." ++ * Alternately, this acknowledgment may appear in the software itself, ++ * if and wherever such third-party acknowledgments normally appear. ++ * ++ * 4. The names "Apache" and "Apache Software Foundation" must ++ * not be used to endorse or promote products derived from this ++ * software without prior written permission. For written ++ * permission, please contact apache@apache.org. ++ * ++ * 5. Products derived from this software may not be called "Apache", ++ * nor may "Apache" appear in their name, without prior written ++ * permission of the Apache Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED ++ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ++ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ++ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ++ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ++ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ * ==================================================================== ++ * ++ * This software consists of voluntary contributions made by many ++ * individuals on behalf of the Apache Software Foundation. For more ++ * information on the Apache Software Foundation, please see ++ * . ++ * ++ * Portions of this software are based upon public domain software ++ * originally written at the National Center for Supercomputing Applications, ++ * University of Illinois, Urbana-Champaign. ++ */ ++ ++#ifdef WIN32 ++ ++#include ++#include ++#include ++ ++#include "readdir.h" ++ ++/********************************************************************** ++ * Implement dirent-style opendir/readdir/closedir on Window 95/NT ++ * ++ * Functions defined are opendir(), readdir() and closedir() with the ++ * same prototypes as the normal dirent.h implementation. ++ * ++ * Does not implement telldir(), seekdir(), rewinddir() or scandir(). ++ * The dirent struct is compatible with Unix, except that d_ino is ++ * always 1 and d_off is made up as we go along. ++ * ++ * The DIR typedef is not compatible with Unix. ++ **********************************************************************/ ++ DIR * opendir(const char *dir) + { +- DIR * dp; +- char *filespec; +- long handle; +- int index; +- filespec = malloc(strlen(dir) + 2 + 1); +- strcpy(filespec, dir); +- index = strlen(filespec) - 1; +- if (index >= 0 && (filespec[index] == '/' || filespec[index] == '\\')) +- filespec[index] = '\0'; +- strcat(filespec, "/*"); +- dp = (DIR *) malloc(sizeof(DIR)); +- dp->offset = 0; +- dp->finished = 0; +- dp->dir = strdup(dir); +- if ((handle = _findfirst(filespec, &(dp->fileinfo))) < 0) { +- if (errno == ENOENT) +- dp->finished = 1; +- ++ DIR * dp; ++ char *filespec; ++ long handle; ++ int index; ++ filespec = malloc(strlen(dir) + 2 + 1); ++ strcpy(filespec, dir); ++ index = strlen(filespec) - 1; ++ if (index >= 0 && (filespec[index] == '/' || filespec[index] == '\\')) ++ filespec[index] = '\0'; ++ strcat(filespec, "/*"); ++ dp = (DIR *) malloc(sizeof(DIR)); ++ dp->offset = 0; ++ dp->finished = 0; ++ dp->dir = strdup(dir); ++ if ((handle = _findfirst(filespec, &(dp->fileinfo))) < 0) { ++ if (errno == ENOENT) ++ dp->finished = 1; ++ + else +- return NULL; +- } +- dp->handle = handle; +- free(filespec); +- return dp; +- } ++ return NULL; ++ } ++ dp->handle = handle; ++ free(filespec); ++ return dp; ++} + +- struct dirent *readdir(DIR * dp) ++struct dirent *readdir(DIR * dp) + { +- if (!dp || dp->finished) ++ if (!dp || dp->finished) + return NULL; +- if (dp->offset != 0) { +- if (_findnext(dp->handle, &(dp->fileinfo)) < 0) { +- dp->finished = 1; +- return NULL; +- } +- } +- dp->offset++; +- strncpy(dp->dent.d_name, dp->fileinfo.name, _MAX_FNAME); +- dp->dent.d_ino = 1; +- dp->dent.d_reclen = (unsigned short)strlen(dp->dent.d_name); +- dp->dent.d_off = dp->offset; +- return &(dp->dent); +- } ++ if (dp->offset != 0) { ++ if (_findnext(dp->handle, &(dp->fileinfo)) < 0) { ++ dp->finished = 1; ++ return NULL; ++ } ++ } ++ dp->offset++; ++ strncpy(dp->dent.d_name, dp->fileinfo.name, _MAX_FNAME); ++ dp->dent.d_ino = 1; ++ dp->dent.d_reclen = (unsigned short)strlen(dp->dent.d_name); ++ dp->dent.d_off = dp->offset; ++ return &(dp->dent); ++} + +- int closedir(DIR * dp) ++int closedir(DIR * dp) + { +- if (!dp) ++ if (!dp) + return 0; +- _findclose(dp->handle); +- if (dp->dir) ++ _findclose(dp->handle); ++ if (dp->dir) + free(dp->dir); +- if (dp) ++ if (dp) + free(dp); +- return 0; +- } ++ return 0; ++} + +- +-#endif /* WIN32 */ ++ ++#endif /* WIN32 */ +diff --git a/src/readdir.h b/src/readdir.h +index a98323d..3eae7b1 100644 +--- a/src/readdir.h ++++ b/src/readdir.h +@@ -1,99 +1,99 @@ +-/* ==================================================================== +- * The Apache Software License, Version 1.1 +- * +- * Copyright (c) 2000 The Apache Software Foundation. All rights +- * reserved. +- * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions +- * are met: +- * +- * 1. Redistributions of source code must retain the above copyright +- * notice, this list of conditions and the following disclaimer. +- * +- * 2. Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimer in +- * the documentation and/or other materials provided with the +- * distribution. +- * +- * 3. The end-user documentation included with the redistribution, +- * if any, must include the following acknowledgment: +- * "This product includes software developed by the +- * Apache Software Foundation (http://www.apache.org/)." +- * Alternately, this acknowledgment may appear in the software itself, +- * if and wherever such third-party acknowledgments normally appear. +- * +- * 4. The names "Apache" and "Apache Software Foundation" must +- * not be used to endorse or promote products derived from this +- * software without prior written permission. For written +- * permission, please contact apache@apache.org. +- * +- * 5. Products derived from this software may not be called "Apache", +- * nor may "Apache" appear in their name, without prior written +- * permission of the Apache Software Foundation. +- * +- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR +- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +- * SUCH DAMAGE. +- * ==================================================================== +- * +- * This software consists of voluntary contributions made by many +- * individuals on behalf of the Apache Software Foundation. For more +- * information on the Apache Software Foundation, please see +- * . +- * +- * Portions of this software are based upon public domain software +- * originally written at the National Center for Supercomputing Applications, +- * University of Illinois, Urbana-Champaign. +- */ +- +-/* +- * Structures and types used to implement opendir/readdir/closedir +- * on Windows 95/NT. +- */ +- +-#ifndef APACHE_READDIR_H +-#define APACHE_READDIR_H +- +-#ifdef WIN32 +- +-#include +-#include +-#include +-#include +- +-/* struct dirent - same as Unix */ ++/* ==================================================================== ++ * The Apache Software License, Version 1.1 ++ * ++ * Copyright (c) 2000 The Apache Software Foundation. All rights ++ * reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in ++ * the documentation and/or other materials provided with the ++ * distribution. ++ * ++ * 3. The end-user documentation included with the redistribution, ++ * if any, must include the following acknowledgment: ++ * "This product includes software developed by the ++ * Apache Software Foundation (http://www.apache.org/)." ++ * Alternately, this acknowledgment may appear in the software itself, ++ * if and wherever such third-party acknowledgments normally appear. ++ * ++ * 4. The names "Apache" and "Apache Software Foundation" must ++ * not be used to endorse or promote products derived from this ++ * software without prior written permission. For written ++ * permission, please contact apache@apache.org. ++ * ++ * 5. Products derived from this software may not be called "Apache", ++ * nor may "Apache" appear in their name, without prior written ++ * permission of the Apache Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED ++ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ++ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ++ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ++ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ++ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ * ==================================================================== ++ * ++ * This software consists of voluntary contributions made by many ++ * individuals on behalf of the Apache Software Foundation. For more ++ * information on the Apache Software Foundation, please see ++ * . ++ * ++ * Portions of this software are based upon public domain software ++ * originally written at the National Center for Supercomputing Applications, ++ * University of Illinois, Urbana-Champaign. ++ */ ++ ++/* ++ * Structures and types used to implement opendir/readdir/closedir ++ * on Windows 95/NT. ++ */ ++ ++#ifndef APACHE_READDIR_H ++#define APACHE_READDIR_H ++ ++#ifdef WIN32 ++ ++#include ++#include ++#include ++#include ++ ++/* struct dirent - same as Unix */ + struct dirent { +- long d_ino; /* inode (always 1 in WIN32) */ +- off_t d_off; /* offset to this dirent */ +- unsigned short d_reclen; /* length of d_name */ +- char d_name[_MAX_FNAME + 1]; /* filename (null terminated) */ +- }; +- +-/* typedef DIR - not the same as Unix */ ++ long d_ino; /* inode (always 1 in WIN32) */ ++ off_t d_off; /* offset to this dirent */ ++ unsigned short d_reclen; /* length of d_name */ ++ char d_name[_MAX_FNAME + 1]; /* filename (null terminated) */ ++}; ++ ++/* typedef DIR - not the same as Unix */ + typedef struct { +- long handle; /* _findfirst/_findnext handle */ +- short offset; /* offset into directory */ +- short finished; /* 1 if there are not more files */ +- struct _finddata_t fileinfo; /* from _findfirst/_findnext */ +- char *dir; /* the dir we are reading */ +- struct dirent dent; /* the dirent to return */ +- } DIR; +- +-/* Function prototypes */ ++ long handle; /* _findfirst/_findnext handle */ ++ short offset; /* offset into directory */ ++ short finished; /* 1 if there are not more files */ ++ struct _finddata_t fileinfo; /* from _findfirst/_findnext */ ++ char *dir; /* the dir we are reading */ ++ struct dirent dent; /* the dirent to return */ ++} DIR; ++ ++/* Function prototypes */ + DIR * opendir(const char *); +- struct dirent *readdir(DIR *); +- int closedir(DIR *); +- +-#endif /* WIN32 */ +- +-#endif /* ndef APACHE_READDIR_H */ ++struct dirent *readdir(DIR *); ++int closedir(DIR *); ++ ++#endif /* WIN32 */ ++ ++#endif /* ndef APACHE_READDIR_H */ +-- +2.42.0.windows.2 + diff --git a/dotconf.spec b/dotconf.spec index 80d6aba..2a313df 100644 --- a/dotconf.spec +++ b/dotconf.spec @@ -1,6 +1,6 @@ Name: dotconf Version: 1.3 -Release: 24 +Release: 25 Summary: A configuration file parser License: LGPLv2 URL: https://github.com/williamh/dotconf @@ -8,6 +8,7 @@ Source: https://github.com/williamh/dotconf/archive/v%{version}.tar.gz BuildRequires: findutils glibc-common make autoconf automake libtool Patch0001: 0001-fix-possible-buffer-overflow-in-get_path.patch +Patch0002: 0001-remove-extra-carriage-returns.patch %description The dotconf package contains a library used to handle configuration @@ -64,6 +65,9 @@ mv %{buildroot}/%{_docdir}/%{name} __doc_dir %doc __doc_dir/* %changelog +* Wed Jan 17 2024 liubo - 1.3-25 +- remove extra carriage returns + * Tue Dec 19 2023 liubo - 1.3-24 - fix possible buffer overflow in get_path