diff options
author | Milan P. Stanić <mps@arvanta.net> | 2019-08-25 16:01:26 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2019-09-05 08:47:18 +0000 |
commit | 7c92c452f53a00bb0f1376f90c0a61a54a93d679 (patch) | |
tree | 04c44431600a93b27e77315583cd0949d83b5dfd | |
parent | 9246da48765ae11d9c23fd109369bbc3cc42e46a (diff) | |
download | aports-7c92c452f53a00bb0f1376f90c0a61a54a93d679.tar.bz2 aports-7c92c452f53a00bb0f1376f90c0a61a54a93d679.tar.xz |
main/postgresql: fix psql segmentation fault
psql segfaults when passing an argument option with a missing argument
patch sent from Quentin Rameau <quinq@fifth.space> fixes it
-rw-r--r-- | main/postgresql/APKBUILD | 4 | ||||
-rw-r--r-- | main/postgresql/fix-psql-segfault.patch | 34 |
2 files changed, 37 insertions, 1 deletions
diff --git a/main/postgresql/APKBUILD b/main/postgresql/APKBUILD index 3d9b9ae9c5..1af759caa1 100644 --- a/main/postgresql/APKBUILD +++ b/main/postgresql/APKBUILD @@ -3,7 +3,7 @@ # Contributor: Jakub Jirutka <jakub@jirutka.cz> pkgname=postgresql pkgver=11.5 -pkgrel=0 +pkgrel=1 pkgdesc="A sophisticated object-relational DBMS" url="https://www.postgresql.org/" arch="all" @@ -26,6 +26,7 @@ source="https://ftp.postgresql.org/pub/source/v$pkgver/$pkgname-$pkgver.tar.bz2 perl-rpath.patch conf-unix_socket_directories.patch disable-broken-tests.patch + fix-psql-segfault.patch $pkgname.initd $pkgname.confd pg-restore.initd @@ -312,6 +313,7 @@ sha512sums="537148079dc6c33cfb9bf9722171e524707b42ef01369deb968d0d6e8fa9b7f16f6c 5f9d8bb4957194069d01af8ab3abc6d4d83a7e7f8bd7ebe1caae5361d621a3e58f91b14b952958138a794e0a80bc154fbb7e3e78d211e2a95b9b7901335de854 perl-rpath.patch 8439a6fdfdea0a4867daeb8bc23d6c825f30c00d91d4c39f48653f5ee77341f23282ce03a77aad94b5369700f11d2cb28d5aee360e59138352a9ab331a9f9d0f conf-unix_socket_directories.patch 274e0a5a6e7d179f5327ae2da0274f13d9198d9acbe45f90e2bdadf454f1e32aceac6a1d4ef2b1744c4468994e93b14a38abea877b419b3fd28b8a3273b5d574 disable-broken-tests.patch +4a241074d27d638743eb56eedbc3cefe5ed4c02b6bf8030940be960d8c09ef88751443162ab405853d8db9ecc4af08ddb250096464d89cae5c0d4d4bf7eeb51f fix-psql-segfault.patch 224e80f9e62843fd248e625abdd0d9fe477729ff3f9a64fc5c86dd37bb7176d3504107fbed7ce578e3a1db7f60b8cf2abf5fe4862c81f76b6d026e29ca495cfc postgresql.initd a6d9cba5c7270484b3a22083b2b37742faefb01b6643040050c92235840c601b2e206ebda32804937b729c6cf42c79a558b921900e52fc420df2a03b5f29e1f7 postgresql.confd f5a1cba051e7d846c2d16703514601cb25729ed96b677c9bd0c199d64552120a8b14b238af01917fdb87106681e12dee6fff7447558155ba273e4f96be5e2892 pg-restore.initd diff --git a/main/postgresql/fix-psql-segfault.patch b/main/postgresql/fix-psql-segfault.patch new file mode 100644 index 0000000000..8f4cc7902c --- /dev/null +++ b/main/postgresql/fix-psql-segfault.patch @@ -0,0 +1,34 @@ +From 9644da5c3ffcf0fb18eca54a61aedb5f53a1c352 Mon Sep 17 00:00:00 2001 +From: Quentin Rameau <quinq@fifth.space> +Date: Sun, 25 Aug 2019 11:29:45 +0200 +Subject: [PATCH] Fix missing argument handling in psql getopt + +When passing an argument option with a missing argument, strcmp would +be called with the argv terminating NULL. +--- + src/bin/psql/startup.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c +index 4730c73396..cffbfc864e 100644 +--- a/src/bin/psql/startup.c ++++ b/src/bin/psql/startup.c +@@ -667,12 +667,13 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts *options) + break; + case '?': + /* Actual help option given */ +- if (strcmp(argv[optind - 1], "-?") == 0) ++ if (optind <= argc && ++ strcmp(argv[optind - 1], "-?") == 0) + { + usage(NOPAGER); + exit(EXIT_SUCCESS); + } +- /* unknown option reported by getopt */ ++ /* unknown option or missing argument */ + else + goto unknown_option; + break; +-- +2.23.0 + |