From 8a69bf5f0c2398116cebabb5e191ce87f996ba5b Mon Sep 17 00:00:00 2001 From: Packit Service Date: Dec 09 2020 20:35:08 +0000 Subject: Apply patch libtar-1.2.11-mem-deref.patch patch_name: libtar-1.2.11-mem-deref.patch present_in_specfile: true location_in_specfile: 2 --- 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; }