Skip to content

Commit

Permalink
Prevent a potential buffer overflow reading the tube name.
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Ross authored and kr committed Oct 18, 2009
1 parent 350de57 commit 6f71178
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions binlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ binlog_read_log_file(binlog b, job binlog_jobs)
}

while (read(b->fd, &namelen, sizeof(size_t)) == sizeof(size_t)) {
if (namelen >= MAX_TUBE_NAME_LEN) {
return binlog_warn(b, "namelen %d exceeds maximum of %d", namelen, MAX_TUBE_NAME_LEN - 1);
}

if (namelen > 0) {
r = read(b->fd, tubename, namelen);
if (r == -1) return twarn("read()");
Expand Down

0 comments on commit 6f71178

Please sign in to comment.