-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #60
- Loading branch information
Showing
2 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
From 9d0394f52324e7ccc62c67ce34cfe6ef9e85f043 Mon Sep 17 00:00:00 2001 | ||
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <[email protected]> | ||
Date: Wed, 18 May 2022 01:02:57 +0200 | ||
Subject: [PATCH] tls: include <functional> | ||
|
||
Fixes compilation with GCC 12.1. | ||
--- | ||
tls/include/adb/tls/tls_connection.h | 1 + | ||
1 file changed, 1 insertion(+) | ||
|
||
diff --git a/tls/include/adb/tls/tls_connection.h b/tls/include/adb/tls/tls_connection.h | ||
index bc5b98ab..a112756c 100644 | ||
--- a/tls/include/adb/tls/tls_connection.h | ||
+++ b/tls/include/adb/tls/tls_connection.h | ||
@@ -19,6 +19,7 @@ | ||
#include <stddef.h> | ||
#include <stdint.h> | ||
|
||
+#include <functional> | ||
#include <string_view> | ||
#include <vector> | ||
|
59 changes: 59 additions & 0 deletions
59
patches/selinux/0002-libselinux-store_stem-do-not-free-possible-non-heap-.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
From 0797bc2697e8ae9d2e3527bf0521274b6ff94473 Mon Sep 17 00:00:00 2001 | ||
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <[email protected]> | ||
Date: Mon, 3 May 2021 17:11:09 +0200 | ||
Subject: [PATCH] libselinux: store_stem(): do not free possible non-heap | ||
object | ||
MIME-Version: 1.0 | ||
Content-Type: text/plain; charset=UTF-8 | ||
Content-Transfer-Encoding: 8bit | ||
|
||
GCC 11 complains: | ||
|
||
In file included from label_file.c:24: | ||
In function ‘store_stem’, | ||
inlined from ‘load_mmap’ at label_file.c:277:12, | ||
inlined from ‘process_file’ at label_file.c:551:5: | ||
label_file.h:289:25: error: ‘free’ called on pointer ‘*mmap_area.next_addr’ with nonzero offset 4 [-Werror=free-nonheap-object] | ||
289 | free(buf); | ||
| ^~~~~~~~~ | ||
|
||
Free the pointer on failure at the caller instead of inside `store_stem()`. | ||
|
||
Signed-off-by: Christian Göttsche <[email protected]> | ||
--- | ||
libselinux/src/label_file.h | 8 ++++++-- | ||
1 file changed, 6 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/libselinux/src/label_file.h b/libselinux/src/label_file.h | ||
index baed3341..9f633701 100644 | ||
--- a/libselinux/src/label_file.h | ||
+++ b/libselinux/src/label_file.h | ||
@@ -286,7 +286,6 @@ static inline int store_stem(struct saved_data *data, char *buf, int stem_len) | ||
tmp_arr = realloc(data->stem_arr, | ||
sizeof(*tmp_arr) * alloc_stems); | ||
if (!tmp_arr) { | ||
- free(buf); | ||
return -1; | ||
} | ||
data->alloc_stems = alloc_stems; | ||
@@ -308,6 +307,7 @@ static inline int find_stem_from_spec(struct saved_data *data, const char *buf) | ||
int stem_len = get_stem_from_spec(buf); | ||
int stemid; | ||
char *stem; | ||
+ int r; | ||
|
||
if (!stem_len) | ||
return -1; | ||
@@ -321,7 +321,11 @@ static inline int find_stem_from_spec(struct saved_data *data, const char *buf) | ||
if (!stem) | ||
return -1; | ||
|
||
- return store_stem(data, stem, stem_len); | ||
+ r = store_stem(data, stem, stem_len); | ||
+ if (r < 0) | ||
+ free(stem); | ||
+ | ||
+ return r; | ||
} | ||
|
||
/* This will always check for buffer over-runs and either read the next entry |