diff options
Diffstat (limited to 'meta-oe/recipes-support/libtar/files/0004-Fix-invalid-memory-de-reference-issue.patch')
-rw-r--r-- | meta-oe/recipes-support/libtar/files/0004-Fix-invalid-memory-de-reference-issue.patch | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/libtar/files/0004-Fix-invalid-memory-de-reference-issue.patch b/meta-oe/recipes-support/libtar/files/0004-Fix-invalid-memory-de-reference-issue.patch new file mode 100644 index 0000000000..b1ecb552bc --- /dev/null +++ b/meta-oe/recipes-support/libtar/files/0004-Fix-invalid-memory-de-reference-issue.patch | |||
@@ -0,0 +1,44 @@ | |||
1 | From c0a89709860acae5ef67727db7b23db385703bf6 Mon Sep 17 00:00:00 2001 | ||
2 | From: Huzaifa Sidhpurwala <huzaifas@fedoraproject.org> | ||
3 | Date: Tue, 15 Oct 2013 14:39:05 +0200 | ||
4 | Subject: [PATCH] Fix invalid memory de-reference issue | ||
5 | |||
6 | Bug: https://bugzilla.redhat.com/551415 | ||
7 | |||
8 | Signed-off-by: Kamil Dudka <kdudka@redhat.com> | ||
9 | |||
10 | Upstream-Status: Backport [https://repo.or.cz/libtar.git/commit/560911b694055b0c677431cf85d4d0d5ebd1a3fd] | ||
11 | |||
12 | Signed-off-by: Katariina Lounento <katariina.lounento@vaisala.com> | ||
13 | --- | ||
14 | lib/libtar.h | 1 + | ||
15 | lib/util.c | 4 +--- | ||
16 | 2 files changed, 2 insertions(+), 3 deletions(-) | ||
17 | |||
18 | diff --git a/lib/libtar.h b/lib/libtar.h | ||
19 | index 55f509a..7fc4d03 100644 | ||
20 | --- a/lib/libtar.h | ||
21 | +++ b/lib/libtar.h | ||
22 | @@ -172,6 +172,7 @@ int th_write(TAR *t); | ||
23 | #define TH_ISDIR(t) ((t)->th_buf.typeflag == DIRTYPE \ | ||
24 | || S_ISDIR((mode_t)oct_to_int((t)->th_buf.mode)) \ | ||
25 | || ((t)->th_buf.typeflag == AREGTYPE \ | ||
26 | + && strlen((t)->th_buf.name) \ | ||
27 | && ((t)->th_buf.name[strlen((t)->th_buf.name) - 1] == '/'))) | ||
28 | #define TH_ISFIFO(t) ((t)->th_buf.typeflag == FIFOTYPE \ | ||
29 | || S_ISFIFO((mode_t)oct_to_int((t)->th_buf.mode))) | ||
30 | diff --git a/lib/util.c b/lib/util.c | ||
31 | index 31e8315..11438ef 100644 | ||
32 | --- a/lib/util.c | ||
33 | +++ b/lib/util.c | ||
34 | @@ -148,9 +148,7 @@ oct_to_int(char *oct) | ||
35 | { | ||
36 | int i; | ||
37 | |||
38 | - sscanf(oct, "%o", &i); | ||
39 | - | ||
40 | - return i; | ||
41 | + return sscanf(oct, "%o", &i) == 1 ? i : 0; | ||
42 | } | ||
43 | |||
44 | |||