Skip to content

Fix splitArgs silently dropping quoted arguments#542

Open
jakemismas wants to merge 1 commit intoSKCraft:masterfrom
jakemismas:fix/splitargs-quoted-arguments
Open

Fix splitArgs silently dropping quoted arguments#542
jakemismas wants to merge 1 commit intoSKCraft:masterfrom
jakemismas:fix/splitargs-quoted-arguments

Conversation

@jakemismas
Copy link
Copy Markdown
Contributor

Summary

The splitArgs regex in JavaProcessBuilder has two capture groups: group(1) for unquoted args and group(2) for quoted args. Only group(1) was ever read, so any quoted argument like "-Dfoo=bar baz" was added as null to the flags list, corrupting the JVM command line.

Changes

  • launcher/src/main/java/com/skcraft/launcher/launch/JavaProcessBuilder.java: fall back to group(2) when group(1) is null

The argsPattern regex has two capture groups: group(1) for unquoted
args and group(2) for quoted args. Only group(1) was being read,
so any quoted argument like "-Dfoo=bar baz" was added as null to
the argument list, corrupting the JVM command line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant