SHA256
1
0
forked from pool/libHX
OBS User unknown 2008-09-25 21:34:41 +00:00 committed by Git OBS Bridge
parent f82e67905f
commit 2cf6cd7832
3 changed files with 65 additions and 1 deletions

53
libHX-hmc-fixes.dif Normal file
View File

@ -0,0 +1,53 @@
Index: libHX-1.23/src/hmc.c
===================================================================
--- libHX-1.23.orig/src/hmc.c
+++ libHX-1.23/src/hmc.c
@@ -70,10 +70,14 @@ EXPORT_SYMBOL hmc_t *hmc_memasg(hmc_t **
CHECK_IDENT(ctx);
if (ctx->alloc < len) {
ctx = realloc(ctx, sizeof(struct memcont) + len);
+ if (ctx == NULL)
+ return NULL;
ctx->alloc = len;
}
} else {
ctx = malloc(sizeof(struct memcont) + len);
+ if (ctx == NULL)
+ return NULL;
ctx->id = HMC_IDENT;
ctx->alloc = len;
}
@@ -102,12 +106,14 @@ EXPORT_SYMBOL hmc_t *hmc_trunc(hmc_t **v
CHECK_IDENT(ctx);
if (len > ctx->alloc) {
ctx = realloc(ctx, sizeof(struct memcont) + len);
+ if (ctx == NULL)
+ return NULL;
ctx->alloc = len;
} else {
ctx->data[len] = '\0';
ctx->length = len;
}
- return ctx->data;
+ return *vp = ctx->data;
}
EXPORT_SYMBOL hmc_t *hmc_strcat(hmc_t **vp, const char *s)
@@ -125,6 +131,8 @@ EXPORT_SYMBOL hmc_t *hmc_memcat(hmc_t **
CHECK_IDENT(ctx);
if (nl > ctx->alloc) {
ctx = realloc(ctx, sizeof(struct memcont) + nl);
+ if (ctx == NULL)
+ return NULL;
ctx->alloc = nl;
}
if (ptr == NULL)
@@ -171,6 +179,8 @@ EXPORT_SYMBOL hmc_t *hmc_memins(hmc_t **
CHECK_IDENT(ctx);
if (ctx->alloc < nl) {
ctx = realloc(ctx, sizeof(struct memcont) + nl);
+ if (ctx == NULL)
+ return NULL;
ctx->alloc = nl;
}
if (ptr == NULL)

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Sep 25 14:54:25 CEST 2008 - mc@suse.de
- pointer was not automatically updated after hmc_trunc()
- make code resistant to memory allocation failure
-------------------------------------------------------------------
Fri Sep 5 09:56:48 CEST 2008 - mc@suse.de

View File

@ -23,11 +23,12 @@ Name: libHX
BuildRequires: gcc-c++ libxml2-devel
Summary: General-purpose Library
Version: 1.23
Release: 1
Release: 2
License: LGPL v2.1 or later; LGPL v3 or later
Prefix: /usr
Group: System/Libraries
Source: %{name}-%{version}.tar.bz2
Patch1: libHX-hmc-fixes.dif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%define debug_package_requires libHX13 = %{version}
Url: http://jengelh.medozas.de/projects/libHX/
@ -128,6 +129,7 @@ Authors:
%prep
%setup -q -n %{name}-%{version}
%patch1 -p1
%build
./autogen.sh;
@ -162,6 +164,9 @@ rm -rf $RPM_BUILD_ROOT
%_libdir/pkgconfig/*.pc
%changelog
* Thu Sep 25 2008 mc@suse.de
- pointer was not automatically updated after hmc_trunc()
- make code resistant to memory allocation failure
* Fri Sep 05 2008 mc@suse.de
- update to version 1.23
- code cleanup: misc.h has been split off libHX.h