Files
openwrt_yocto/meta-openembedded/meta-oe/recipes-support/libtar/files/0004-Fix-invalid-memory-de-reference-issue.patch
T
francis.wang 4c86c082a2 Initial commit: OpenWrt-Yocto monorepo
Combine poky (Yocto scarthgap), meta-openembedded (scarthgap), and
meta-openwrt into a single repository.

Components:
- poky/             Yocto core framework (BitBake + OE-Core)
- meta-openembedded/ Community layers (meta-oe, meta-python, meta-networking)
- meta-openwrt/     OpenWrt customization layer
- setup-env.sh      One-click build environment setup
- README.md         Project documentation
2026-07-11 13:28:01 +08:00

45 lines
1.3 KiB
Diff

From c0a89709860acae5ef67727db7b23db385703bf6 Mon Sep 17 00:00:00 2001
From: Huzaifa Sidhpurwala <huzaifas@fedoraproject.org>
Date: Tue, 15 Oct 2013 14:39:05 +0200
Subject: [PATCH] Fix invalid memory de-reference issue
Bug: https://bugzilla.redhat.com/551415
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
Upstream-Status: Backport [https://repo.or.cz/libtar.git/commit/560911b694055b0c677431cf85d4d0d5ebd1a3fd]
Signed-off-by: Katariina Lounento <katariina.lounento@vaisala.com>
---
lib/libtar.h | 1 +
lib/util.c | 4 +---
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/libtar.h b/lib/libtar.h
index 55f509a..7fc4d03 100644
--- a/lib/libtar.h
+++ b/lib/libtar.h
@@ -172,6 +172,7 @@ int th_write(TAR *t);
#define TH_ISDIR(t) ((t)->th_buf.typeflag == DIRTYPE \
|| S_ISDIR((mode_t)oct_to_int((t)->th_buf.mode)) \
|| ((t)->th_buf.typeflag == AREGTYPE \
+ && strlen((t)->th_buf.name) \
&& ((t)->th_buf.name[strlen((t)->th_buf.name) - 1] == '/')))
#define TH_ISFIFO(t) ((t)->th_buf.typeflag == FIFOTYPE \
|| S_ISFIFO((mode_t)oct_to_int((t)->th_buf.mode)))
diff --git a/lib/util.c b/lib/util.c
index 31e8315..11438ef 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -148,9 +148,7 @@ oct_to_int(char *oct)
{
int i;
- sscanf(oct, "%o", &i);
-
- return i;
+ return sscanf(oct, "%o", &i) == 1 ? i : 0;
}