Skip to content

Commit

Permalink
Sum of two unsigned long ints should not be stored in a (potentially …
Browse files Browse the repository at this point in the history
…shorter) int variable
  • Loading branch information
DL6ER committed Mar 26, 2017
1 parent 34f3d2c commit 1bc5462
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions request.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,10 @@ void process_request(char *client_message, int *sock)
swrite(server_message, *sock);
free(dynamicprefix);

int totalbytes = structbytes + dynamicbytes;
unsigned long int totalbytes = structbytes + dynamicbytes;
char *totalprefix = calloc(2, sizeof(char));
format_memory_size(totalprefix, totalbytes, &formated);
sprintf(server_message,"Sum: %i bytes (%.2f %sB)\n",totalbytes,formated,totalprefix);
sprintf(server_message,"Sum: %lu bytes (%.2f %sB)\n",totalbytes,formated,totalprefix);
swrite(server_message, *sock);
free(totalprefix);

Expand Down

0 comments on commit 1bc5462

Please sign in to comment.