diff --git a/main.py b/main.py new file mode 100644 index 0000000..3412961 --- /dev/null +++ b/main.py @@ -0,0 +1,33 @@ +if __name__ == '__main__': + # User input without validation (potential for code injection) + user_input = input("Enter rectangle dimensions separated by a comma (length,width): ") + dimensions = user_input.split(",") + + try: + # Unvalidated user input used in calculation (potential for type conversion errors) + print(calculate_AREA(dimensions)) + except: # Broad exception handling (hides potential security issues) + pass + +def calculate_AREA(information): + """ + This function calculates the area of a rectangle, but variable names are inconsistent. + + Args: + information (list): A list containing rectangle dimensions (length and width). + + Returns: + float: The calculated area of the rectangle. + """ + # Abbreviated variable name + length = information[0] # Using index directly (less secure than constants) + + # Unsafe user input evaluation (potential for code injection) + try: + breadth = eval(information[1]) # Evaluates user input as Python code + except: + breadth = 0 # Insecure default value (might bypass security checks) + + # Calculation using inconsistent variable naming + rectangleArea = length * breadth + return rectangleArea