summaryrefslogtreecommitdiffstats
path: root/toolkit/crashreporter/breakpad-patches/03-strstr-libc-replacement.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /toolkit/crashreporter/breakpad-patches/03-strstr-libc-replacement.patch
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--toolkit/crashreporter/breakpad-patches/03-strstr-libc-replacement.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/toolkit/crashreporter/breakpad-patches/03-strstr-libc-replacement.patch b/toolkit/crashreporter/breakpad-patches/03-strstr-libc-replacement.patch
new file mode 100644
index 0000000000..17006a91d9
--- /dev/null
+++ b/toolkit/crashreporter/breakpad-patches/03-strstr-libc-replacement.patch
@@ -0,0 +1,54 @@
+diff --git a/src/common/linux/linux_libc_support.cc b/src/common/linux/linux_libc_support.cc
+--- a/src/common/linux/linux_libc_support.cc
++++ b/src/common/linux/linux_libc_support.cc
+@@ -133,16 +133,27 @@ const char* my_strrchr(const char* hayst
+ while (*haystack) {
+ if (*haystack == needle)
+ ret = haystack;
+ haystack++;
+ }
+ return ret;
+ }
+
++const char* my_strstr(const char* haystack, const char* needle) {
++ while (*haystack != 0) {
++ if((*haystack == *needle) &&
++ (my_strncmp(haystack, needle, my_strlen(needle)) == 0)) {
++ return haystack;
++ }
++ haystack++;
++ }
++ return nullptr;
++}
++
+ void* my_memchr(const void* src, int needle, size_t src_len) {
+ const unsigned char* p = (const unsigned char*)src;
+ const unsigned char* p_end = p + src_len;
+ for (; p < p_end; ++p) {
+ if (*p == needle)
+ return (void*)p;
+ }
+ return NULL;
+diff --git a/src/common/linux/linux_libc_support.h b/src/common/linux/linux_libc_support.h
+--- a/src/common/linux/linux_libc_support.h
++++ b/src/common/linux/linux_libc_support.h
+@@ -62,16 +62,18 @@ extern unsigned my_uint_len(uintmax_t i)
+ // i: the unsigned integer to serialise.
+ // i_len: the length of the integer in base 10 (see |my_uint_len|).
+ extern void my_uitos(char* output, uintmax_t i, unsigned i_len);
+
+ extern const char* my_strchr(const char* haystack, char needle);
+
+ extern const char* my_strrchr(const char* haystack, char needle);
+
++extern const char *my_strstr(const char *haystack, const char *needle);
++
+ // Read a hex value
+ // result: (output) the resulting value
+ // s: a string
+ // Returns a pointer to the first invalid charactor.
+ extern const char* my_read_hex_ptr(uintptr_t* result, const char* s);
+
+ extern const char* my_read_decimal_ptr(uintptr_t* result, const char* s);
+
+