You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sentry.apache.org by "Jan Hentschel (JIRA)" <ji...@apache.org> on 2017/03/15 17:38:41 UTC
[jira] [Commented] (SENTRY-1657) Possible null-pointer dereference
in SentryMain
[ https://issues.apache.org/jira/browse/SENTRY-1657?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15926622#comment-15926622 ]
Jan Hentschel commented on SENTRY-1657:
---------------------------------------
[~akolb] Can *commandClazz* really be null in the try-block? If *commandClazz* is null in the if-statement it will go to the *printHelp* method which exits with a 1 code.
{code:java}
private static void printHelp(Options options, String msg) {
String sentry = "sentry";
if (msg != null) {
sentry = msg + sentry;
}
(new HelpFormatter()).printHelp(sentry, options);
System.exit(1);
}
{code}
> Possible null-pointer dereference in SentryMain
> -----------------------------------------------
>
> Key: SENTRY-1657
> URL: https://issues.apache.org/jira/browse/SENTRY-1657
> Project: Sentry
> Issue Type: Bug
> Components: Sentry
> Affects Versions: 1.8.0
> Reporter: Alexander Kolbasov
> Priority: Minor
> Labels: bite-sized, newbie
>
> In SentryMain.java there is the following code:
> {code}
> String commandClazz = COMMANDS.get(commandName);
> if (commandClazz == null) { // may be null here
> printHelp(options, "Unknown command " + commandName + "\n");
> }
> Object command;
> try {
> command = Class.forName(commandClazz.trim()).newInstance(); // dereference null here
> ...
> {code}
> Note that commandClazz may be null and yet be dereferenced.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)