The product sends non-cloned mutable data as an argument to a method or function.
The function or method that has been called can alter or delete the mutable data. This could violate assumptions that the calling function has made about its state. In situations where unknown code is called with references to mutable data, this external code could make changes to the data sent. If this data was not previously cloned, the modified data might not be valid in the context of execution.
Impact: Modify Memory
Potentially data could be tampered with by another function which should not have been tampered with.
cjava
// constructor for BookStore* public BookStore() { ``` this.inventory = new BookStoreInventory(); this.sales = new SalesDBManager(); ... } public void updateSalesAndInventoryForBookSold(String bookISBN) {
java
// Book object constructors and get/set methods* ...}
java
// Get book object from inventory using ISBN* Book book = inventory.getBookWithISBN(bookISBN);
javaMedium