Skip to content

Commit

Permalink
[pkgconf] fix asan issue (#29017)
Browse files Browse the repository at this point in the history
* [pkgconf] fix asan error

* v db
  • Loading branch information
Neumann-A committed Jan 18, 2023
1 parent 01350d0 commit fe5f181
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 2 deletions.
45 changes: 45 additions & 0 deletions ports/pkgconf/bufferoverflow.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
diff --git a/cli/getopt_long.c b/cli/getopt_long.c
index c47215fae..4dcac3d7d 100644
--- a/cli/getopt_long.c
+++ b/cli/getopt_long.c
@@ -377,27 +376,28 @@ getopt_internal(int nargc, char * const *nargv, const char *options,

if (options == NULL)
return (-1);
-
/*
* Disable GNU extensions if POSIXLY_CORRECT is set or options
* string begins with a '+'.
*/
posixly_correct = (getenv("POSIXLY_CORRECT") != NULL);
+ if(strcmp(options,"")!=0)
+ {
#ifdef GNU_COMPATIBLE
- if (*options == '-')
- flags |= FLAG_ALLARGS;
- else if (posixly_correct || *options == '+')
- flags &= ~FLAG_PERMUTE;
+ if (*options == '-')
+ flags |= FLAG_ALLARGS;
+ else if (posixly_correct || *options == '+')
+ flags &= ~FLAG_PERMUTE;
#else
- if (posixly_correct || *options == '+')
- flags &= ~FLAG_PERMUTE;
- else if (*options == '-')
- flags |= FLAG_ALLARGS;
+ if (posixly_correct || *options == '+')
+ flags &= ~FLAG_PERMUTE;
+ else if (*options == '-')
+ flags |= FLAG_ALLARGS;
#endif

- if (*options == '+' || *options == '-')
- options++;
-
+ if (*options == '+' || *options == '-')
+ options++;
+ }
/*
* XXX Some GNU programs (like cvs) set pkg_optind to 0 instead of
* XXX using pkg_optreset. Work around this braindamage.
1 change: 1 addition & 0 deletions ports/pkgconf/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ vcpkg_from_github(
REF cef30268e1a3f79efd607c26abcf556aa314c9c4
SHA512 ea03b81d01521201bdc471a39cdc8b13f9452f7cc78706d5c57056595f3e4e8a3562c022ebb72ce6444f2c7a8dfc778114814ef5064eaef770a70cc294c7f7ee
HEAD_REF master
PATCHES bufferoverflow.patch
)

vcpkg_configure_meson(
Expand Down
2 changes: 1 addition & 1 deletion ports/pkgconf/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pkgconf",
"version": "1.8.0",
"port-version": 3,
"port-version": 4,
"description": "pkgconf is a program which helps to configure compiler and linker flags for development libraries. It is similar to pkg-config from freedesktop.org.",
"homepage": "https://github.com/pkgconf/pkgconf",
"license": null,
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -5910,7 +5910,7 @@
},
"pkgconf": {
"baseline": "1.8.0",
"port-version": 3
"port-version": 4
},
"plasma-wayland-protocols": {
"baseline": "1.8.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/p-/pkgconf.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "1b19a4f679f330a422d353f54a9148fa3672c2c1",
"version": "1.8.0",
"port-version": 4
},
{
"git-tree": "a0408f161d8a23907635840add678d5946024d09",
"version": "1.8.0",
Expand Down

0 comments on commit fe5f181

Please sign in to comment.