Skip to content

Commit

Permalink
fixed buffer overflow, sizeof() is a compiletime method yet buf's siz…
Browse files Browse the repository at this point in the history
…e is determined during runtime

(taken from thieso2's fork of proxytunnel)
  • Loading branch information
Daniel Jonka committed Feb 3, 2016
1 parent a3a1ffa commit 5472415
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions io.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ int readline(PTSTREAM *pts) {

if( args_info.verbose_flag ) {
/* Copy line of data into dstr without trailing newline */
char *dstr = malloc(sizeof(buf) + 1);
strlcpy( dstr, buf, strlen(buf) - 1);
char *dstr = malloc(strlen(buf) + 1);
strlcpy( dstr, buf, strlen(buf) );
if (strcmp(dstr, ""))
message( " <- %s\n", dstr );
}
Expand Down

0 comments on commit 5472415

Please sign in to comment.