org.owasp.jbrofuzz3.message.FuzzPoint Maven / Gradle / Ivy
package org.owasp.jbrofuzz3.message;
/**
* A fuzz point is a position of set length
* within a message.
*
* A fuzz point indexes a message in the same
* way as a String.charAt() indexes a String.
*
* @author [email protected]
* @version 2.5
* @since 2.5
*
*/
public class FuzzPoint {
private int start, end;
/**
*
Create a fuzz point, which starts
* at position within a message
* and ends at position .
*
* These two numbers must be greater
* or equal to zero, cannot be equal
* and end has to be larger than start.
*
* {@link isValid}
*/
public FuzzPoint(int start, int end) {
super();
this.start = start;
this.end = end;
}
public int getStart() {
return start;
}
public void setStart(int start) {
this.start = start;
}
public int getEnd() {
return end;
}
public void setEnd(int end) {
this.end = end;
}
/**
* These two numbers must be greater
* or equal to zero, cannot be equal
* and end has to be larger than start.
*
*/
public boolean isValid() {
if( (start >= 0) && (start < end) ) {
return true;
} else {
return false;
}
}
/**
* These two numbers must be greater
* or equal to zero, cannot be equal
* and end has to be larger than start.
*
* Also, end must be less than or equal
* to the total message length, as obtained
* by String.legth().
*/
public boolean isValid(int messageLength) {
if( (start >= 0) && (start < end) && (end <= messageLength) ) {
return true;
} else {
return false;
}
}
}