summaryrefslogtreecommitdiffstats
path: root/network/elinks/patches/0006-gopher-indexes_nocr.patch
diff options
context:
space:
mode:
Diffstat (limited to 'network/elinks/patches/0006-gopher-indexes_nocr.patch')
-rw-r--r--network/elinks/patches/0006-gopher-indexes_nocr.patch23
1 files changed, 23 insertions, 0 deletions
diff --git a/network/elinks/patches/0006-gopher-indexes_nocr.patch b/network/elinks/patches/0006-gopher-indexes_nocr.patch
new file mode 100644
index 0000000000..797c9a8b55
--- /dev/null
+++ b/network/elinks/patches/0006-gopher-indexes_nocr.patch
@@ -0,0 +1,23 @@
+#######################################################################
+# Fixes index listings with only LF and no CRs.
+# dave@slackbuilds.org
+#######################################################################
+diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c
+--- a/src/protocol/gopher/gopher.c 2020-01-08 07:39:33.403725857 +0000
++++ b/src/protocol/gopher/gopher.c 2020-01-08 07:40:30.587406965 +0000
+@@ -779,6 +779,15 @@
+ switch (gopher->entity->type) {
+ case GOPHER_DIRECTORY:
+ case GOPHER_INDEX:
++ /* Lines with no carriage returns */
++ if (strchr(rb->data, ASCII_CR) == NULL) {
++ unsigned char *tmp = malloc(rb->length + 3);
++ tmp[0] = 'i';
++ tmp = stpcpy(stpcpy(stpcpy(tmp, rb->data), '\r'), '\n');
++ rb->length += 3;
++ memcpy(rb->data, tmp, rb->length);
++ free(tmp);
++ }
+ state = read_gopher_directory_data(conn, rb);
+ break;
+