Skip to content
Snippets Groups Projects
Commit d1b0e950 authored by Raymond Toy's avatar Raymond Toy
Browse files

Fix potential write past end of buffer.

We wanted to read one byte into the second byte of "byte", but didn't
cast everything correctly, so we ended up reading the byte past the
end of "byte".
parent aa96ed2c
No related branches found
No related tags found
No related merge requests found
......@@ -110,7 +110,10 @@ void greet_client(int socket) {
/* Read byte-swap thing */
result = read(socket,&byte,2);
if( !result ) fatal_error("greet_client: Unable to read initial data.");
else if( result == 1 ) read(socket,&byte+1,1);
else if( result == 1 ) {
result = read(socket, ((char *) &byte)+1,1);
fatal_error("greet_client: Unable to read initial data.");
}
swap_bytes = (byte!=1);
if( global_will_trace ) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment