Skip to content

Commit 52240ad

Browse files
authored
Merge pull request #11 from grddev/master
Avoid segfault when arguments contain format strings
2 parents 7e4d7ea + dc2af81 commit 52240ad

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

spec/launcher_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,4 +255,8 @@
255255
it "should print the version" do
256256
jruby_launcher("-Xversion 2>&1").should =~ /Launcher Version #{JRubyLauncher::VERSION}/
257257
end
258+
259+
it "should not crash on format-strings" do
260+
jruby_launcher_args("-e %s%s%s%s%s 2>&1").should include('-e', '%s%s%s%s%s')
261+
end
258262
end

unixlauncher.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ int UnixLauncher::run(int argc, char* argv[], char* envp[]) {
7171

7272
logMsg("Command line:");
7373
for (list<string>::iterator it = commandLine.begin(); it != commandLine.end(); ++it) {
74-
logMsg(it->c_str());
74+
logMsg("\t%s", it->c_str());
7575
}
7676

7777
char** newArgv = convertToArgvArray(commandLine);

0 commit comments

Comments
 (0)