ebook-tools/ebook-tools-0.2.2-fix_null_ptr.patch

27 lines
1001 B
Diff
Raw Permalink Normal View History

diff -ur ebook-tools-0.2.2.0/src/libepub/linklist.c ebook-tools-0.2.2/src/libepub/linklist.c
--- ebook-tools-0.2.2.0/src/libepub/linklist.c 2012-09-04 07:32:32.000000000 -0700
+++ ebook-tools-0.2.2/src/libepub/linklist.c 2019-09-19 17:38:55.499059141 -0700
@@ -115,7 +115,8 @@
while ((Compare = (List->compare)(List->Current->Data, Data)) != 0) {
List->Current = List->Current->Next;
- if (List->Current == NULL)
+ if ((List->Current == NULL) ||
+ (List->Current->Data == NULL))
return NULL; // end of list
}
}
diff -ur ebook-tools-0.2.2.0/src/libepub/list.c ebook-tools-0.2.2/src/libepub/list.c
--- ebook-tools-0.2.2.0/src/libepub/list.c 2012-09-04 07:32:32.000000000 -0700
+++ ebook-tools-0.2.2/src/libepub/list.c 2019-09-19 17:33:49.780068574 -0700
@@ -137,6 +137,9 @@
int _list_cmp_label_by_lang(struct tocLabel *t1, struct tocLabel *t2) {
+ if ((t1 == NULL) || (t2 == NULL))
+ return 0;
+
if (! t1->lang || ! t2->lang)
return 0;