Patent ID: 7730322

Claim:
A method of controlling a computer to protect a computer program executed by said computer from attacks by malicious software using buffer overflows, the method comprising: a) identifying an area in data memory associated with a buffer to which data, in the form of an incoming message, argument, or other communicated value, is written to, or read from, during execution of said computer program: b) encoding said data, even if said data overflows said buffer, using an encoding selected from a plurality of encodings, to result in encoded data; said plurality of encodings include a specific encoding comprising an addition of a byte constant K (mod 256) to each data byte being encoded, thus permitting decoding of each said data byte by adding a complementary constant; c) repeating steps a) and b) for each of a plurality of different areas of the data memory associated with different buffers to which data is written to, or read from, during execution of the computer program, such that data within adjacent buffers are encoded with different encodings selected from the plurality of encodings, and such that encoded data in adjacent buffers requires different decoding; and d) decoding data within each adjacent buffer based on the encoding used for each adjacent buffer such that said data which overflows said buffer into an adjacent buffer will not be properly decoded, to prevent buffer overflow from one buffer to an adjacent buffer to be used by the malicious software; wherein encodings used to encode data are mathematically simple and constants to be used in said encoding are selected based on a storage address of data to be encoded.