Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- Makefile Mon Oct 19 03:57:21 2020
- +++ Makefile Mon Oct 19 03:38:46 2020
- @@ -1,9 +1,9 @@
- -CC = gcc
- +CC = cc
- CFLAGS = -DNDEBUG -O2 -Wall -Wextra -fno-strict-aliasing
- override CFLAGS += $(shell curl-config --cflags) $(shell xml2-config --cflags)
- -LDLIBS = $(shell curl-config --libs) $(shell xml2-config --libs) -lm -lseccomp
- +LDLIBS = $(shell curl-config --libs) $(shell xml2-config --libs) -lm
- BINDIR = /usr/bin
- MANDIR = /usr/share/man/man1
- --- rdrview.c Mon Oct 19 03:57:21 2020
- +++ rdrview.c Mon Oct 19 03:47:15 2020
- @@ -30,7 +30,9 @@
- #include <string.h>
- #include <getopt.h>
- #include <signal.h>
- +#ifndef __OpenBSD__
- #include <seccomp.h>
- +#endif
- #include <sys/types.h>
- #include <sys/wait.h>
- #include <sys/stat.h>
- @@ -164,7 +166,7 @@
- /* Just ignore failures, we can guess the encoding or get it elsewhere */
- if (curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &type) || !type)
- return;
- - charset = strcasestr(type, "charset="); /* TODO: whitespace? */
- + charset = Mystrcasestr(type, "charset="); /* TODO: whitespace? */
- if (!charset)
- return;
- @@ -272,7 +274,7 @@
- /**
- * Wrapper around xmlStrcasestr() that takes chars and doesn't return constants
- */
- -static inline char *strcasestr(const char *haystack, const char *needle)
- +static inline char *Mystrcasestr(const char *haystack, const char *needle)
- {
- return (char *)xmlStrcasestr((xmlChar *)haystack, (xmlChar *)needle);
- }
- @@ -293,7 +295,7 @@
- lastchar = map[size - 1];
- map[size - 1] = '\0';
- - opentag = strcasestr(map, "<script");
- + opentag = Mystrcasestr(map, "<script");
- while (opentag) {
- char *gt, *closetag;
- @@ -301,14 +303,14 @@
- if (!gt)
- break; /* Malformed html, just ignore it for now and move on */
- if (*(gt - 1) == '/') { /* No closing tag for this node */
- - opentag = strcasestr(gt, "<script");
- + opentag = Mystrcasestr(gt, "<script");
- continue;
- }
- - closetag = strcasestr(gt, "</script>");
- + closetag = Mystrcasestr(gt, "</script>");
- if (!closetag)
- break; /* Malformed html, just ignore it for now and move on */
- memset(gt + 1, 'X', closetag - (gt + 1));
- - opentag = strcasestr(closetag, "<script");
- + opentag = Mystrcasestr(closetag, "<script");
- }
- map[size - 1] = lastchar;
- @@ -692,6 +694,7 @@
- sigaction(SIGTERM, &act, NULL);
- }
- +#ifndef __OpenBSD__
- /**
- * Restrict the process to working with its existing temporary files
- */
- @@ -746,6 +749,7 @@
- }
- }
- #endif /* NDEBUG */
- +#endif /* __OpenBSD__ */
- /* Descriptors for the encodings supported via iconv; for now only GB2312 */
- static iconv_t gb2312_cd;
- @@ -786,9 +790,11 @@
- stdin_to_file(input_fp);
- /* TODO: consider ways to sandbox the libcurl stuff as well */
- - start_sandbox();
- - assert_sandbox_works();
- +#ifndef __OpenBSD__
- + start_sandbox();
- + assert_sandbox_works();
- +#endif
- doc = parse_file(input_fp);
- init_regexes();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement