harbor run -t openthoughts/tasktrove-inferredbugs-sandboxes-verifier-inferredbugs-9849harbor download openthoughts/tasktrove-inferredbugs-sandboxes-verifier-inferredbugs-9849Project: shiro Bug ID: 5 Language: java
Before (Buggy File):
/*
* Copyright (C) 2005-2007 Jeremy Haile
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
* Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the
*
* Free Software Foundation, Inc.
* 59 Temple Place, Suite 330
* Boston, MA 02111-1307
* USA
*
* Or, you may view it online at
* http://www.opensource.org/licenses/lgpl-license.php
*/
package org.jsecurity.web.tags;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
/**
* JSP tag that renders the tag body if the current user is authenticated. If the
* user is not authenticated, the tag body is skipped.
*
* @since 0.2
* @author Jeremy Haile
*/
public class AuthenticatedTag extends SecureTag {
public int onDoStartTag() throws JspException {
if ( getSecurityContext().isAuthenticated() ) {
return TagSupport.EVAL_BODY_INCLUDE;
} else {
return TagSupport.SKIP_BODY;
}
}
}
PROVER
ERROR
NULL_DEREFERENCE
object returned by getSecurityContext() could be null and is dereferenced at line 40.
HIGH
user
int AuthenticatedTag.onDoStartTag()
org.jsecurity.web.tags.AuthenticatedTag.onDoStartTag():int.539c7248984da4a96fbf899440f7f0b0
src/org/jsecurity/web/tags/AuthenticatedTag.java
AuthenticatedTag.java|onDoStartTag|NULL_DEREFERENCE
18086a76ec6f499138a84f176568ec09
23be63c349372e2cd58613b49fdeb9e0
Null Dereference
Fix the bug in the code.
Write the complete, corrected version of the file to: /app/src/org/jsecurity/web/tags/AuthenticatedTag.java.
The directory does not exist yet. You must create it and write the file:
mkdir -p /app/src/org/jsecurity/web/tags
cat > /app/src/org/jsecurity/web/tags/AuthenticatedTag.java << 'ENDOFFILE'
<full corrected file content here>
ENDOFFILE