void-packages/srcpkgs/libxdg-basedir/patches/overflow-bug.patch
Đoàn Trần Công Danh 861ac185a6 srcpkgs/l*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

23 lines
834 B
Diff

From 14e000f696ef8b83264b0ca4407669bdb365fb23 Mon Sep 17 00:00:00 2001
From: Timmy Weerwag <timmy@timmyweerwag.nl>
Date: Sun, 16 Mar 2014 17:54:14 +0100
Subject: [PATCH] Overflow bug
---
src/basedir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/basedir.c b/src/basedir.c
index 68ab879..1a2a8c4 100644
--- a/src/basedir.c
+++ b/src/basedir.c
@@ -574,7 +574,7 @@ static char * xdgGetRelativeHome(const char *envname, const char *relativefallba
unsigned int homelen;
if (!(home = xdgGetEnv("HOME")))
return NULL;
- if (!(relhome = (char*)malloc((homelen = strlen(home))+fallbacklength))) return NULL;
+ if (!(relhome = (char*)malloc((homelen = strlen(home))+fallbacklength+1))) return NULL;
memcpy(relhome, home, homelen);
memcpy(relhome+homelen, relativefallback, fallbacklength+1);
}