void-packages/srcpkgs/netpgp/patches/lib_reader_c.patch
Đoàn Trần Công Danh 65749575ab srcpkgs/n*: 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

26 lines
691 B
Diff

$NetBSD: patch-src_lib_reader.c,v 1.1 2018/03/15 19:51:08 khorben Exp $
Do not truncate pass-phrases without a newline character.
--- a/src/lib/reader.c 2012-03-05 02:20:18.000000000 +0000
+++ b/src/lib/reader.c
@@ -160,6 +160,7 @@ int
pgp_getpassphrase(void *in, char *phrase, size_t size)
{
char *p;
+ size_t len;
if (in == NULL) {
while ((p = getpass("netpgp passphrase: ")) == NULL) {
@@ -169,7 +170,10 @@ pgp_getpassphrase(void *in, char *phrase
if (fgets(phrase, (int)size, in) == NULL) {
return 0;
}
- phrase[strlen(phrase) - 1] = 0x0;
+ len = strlen(phrase);
+ if (len >= 1 && phrase[len - 1] == '\n') {
+ phrase[len - 1] = '\0';
+ }
}
return 1;
}