← All comics

Any number at all

#174

Toby replaced the shop's plus and minus buttons with a box where customers type how many sofas they want. It accepted minus numbers, and paid them for it.

The mistake

The quantity box accepts any number and nothing on the server checks it, so a negative quantity goes straight into the order. The total is calculated as price × quantity, which comes out negative, and the payment step treats a negative charge as money to send back to the customer. Quantity should be validated on the server as a whole number of at least 1 (with a sensible maximum), and a checkout total below zero should be rejected, not paid out.

Share