diff --git a/libqalculate-buffer.patch b/libqalculate-buffer.patch new file mode 100644 index 0000000..970ca04 --- /dev/null +++ b/libqalculate-buffer.patch @@ -0,0 +1,73 @@ +diff -up libqalculate-0.9.7/libqalculate/util.cc.buffer libqalculate-0.9.7/libqalculate/util.cc +--- libqalculate-0.9.7/libqalculate/util.cc.buffer 2009-12-02 21:24:27.000000000 +0100 ++++ libqalculate-0.9.7/libqalculate/util.cc 2016-04-25 13:41:49.889530190 +0200 +@@ -26,8 +26,6 @@ bool eqstr::operator()(const char *s1, c + return strcmp(s1, s2) == 0; + } + +-char buffer[20000]; +- + string date2s(int year, int month, int day) { + string str = i2s(year); + str += "-"; +@@ -522,36 +520,54 @@ string& remove_parenthesis(string &str) + + string d2s(double value, int precision) { + // qgcvt(value, precision, buffer); +- sprintf(buffer, "%.*G", precision, value); ++ char *buffer = NULL; ++ if (asprintf(&buffer, "%.*G", precision, value) == -1) ++ exit(EXIT_FAILURE); + string stmp = buffer; ++ free(buffer); + // gsub("e", "E", stmp); + return stmp; + } + + string p2s(void *o) { +- sprintf(buffer, "%p", o); ++ char *buffer = NULL; ++ if (asprintf(&buffer, "%p", o) == -1) ++ exit(EXIT_FAILURE); + string stmp = buffer; ++ free(buffer); + return stmp; + } + string i2s(int value) { + // char buffer[10]; +- sprintf(buffer, "%i", value); ++ char *buffer = NULL; ++ if (asprintf(&buffer, "%i", value) == -1) ++ exit(EXIT_FAILURE); + string stmp = buffer; ++ free(buffer); + return stmp; + } + string i2s(long int value) { +- sprintf(buffer, "%li", value); ++ char *buffer = NULL; ++ if (asprintf(&buffer, "%li", value) == -1) ++ exit(EXIT_FAILURE); + string stmp = buffer; ++ free(buffer); + return stmp; + } + string i2s(unsigned int value) { +- sprintf(buffer, "%u", value); ++ char *buffer = NULL; ++ if (asprintf(&buffer, "%u", value) == -1) ++ exit(EXIT_FAILURE); + string stmp = buffer; ++ free(buffer); + return stmp; + } + string i2s(unsigned long int value) { +- sprintf(buffer, "%lu", value); ++ char *buffer = NULL; ++ if (asprintf(&buffer, "%lu", value) == -1) ++ exit(EXIT_FAILURE); + string stmp = buffer; ++ free(buffer); + return stmp; + } + const char *b2yn(bool b, bool capital) { diff --git a/libqalculate.spec b/libqalculate.spec index f5947e8..d943a23 100644 --- a/libqalculate.spec +++ b/libqalculate.spec @@ -1,7 +1,7 @@ Summary: Multi-purpose calculator library Name: libqalculate Version: 0.9.7 -Release: 17%{?dist} +Release: 18%{?dist} License: GPLv2+ Group: System Environment/Libraries URL: http://qalculate.sourceforge.net/ @@ -9,8 +9,9 @@ Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz Patch1: libqalculate-0.9.7-pkgconfig_private.patch Patch2: libqalculate-htmldir.patch # don't spam errors if euroref-daily.xml doesn't (yet) exist -Patch3: libqalculate-0.9.7-euroref-daily.patch -Patch4: gcc-6-compile.patch +Patch3: libqalculate-0.9.7-euroref-daily.patch +Patch4: gcc-6-compile.patch +Patch5: libqalculate-buffer.patch BuildRequires: glib2-devel, cln-devel BuildRequires: libxml2-devel @@ -51,6 +52,7 @@ frontends are provided by qalculate-gtk and qalculate-kde packages resp. %patch2 -p0 -b .htmldir-unversioned %patch3 -p1 -b .euroref-daily %patch4 +%patch5 -p1 -b .buffer %build %configure --disable-static @@ -86,6 +88,9 @@ rm -f %{buildroot}/%{_libdir}/*.la %{_bindir}/qalc %changelog +* Mon Apr 25 2016 Than Ngo - 0.9.7-18 +- bz#953615, fix global variable buffer + * Thu Feb 18 2016 Mukundan Ragavan - 0.9.7-17 - Add BR:perl(Getopt::Long) - Added doc to %files section