Skip to content

Commit

Permalink
dir: avoid heap-overflow during verify job
Browse files Browse the repository at this point in the history
Fixes #1210: Security vulnerability results in heap overflow in director
             when doing a Verify job against a file daemon.

Previously the code did not check that the target buffer that scanf()
wrote into was big enough to fit the data.
This patch now resizes the buffer to the size of the message buffer that
is being parsed ensuring that there is no heap overflow anymore.

(cherry picked from commit 86c6fa4)
  • Loading branch information
arogge committed Jul 9, 2020
1 parent b08abf2 commit 1faaffa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/dird/fd_cmds.cc
Expand Up @@ -1115,7 +1115,7 @@ int GetAttributesAndPutInCatalog(JobControlRecord* jcr)
int stream, len;
char *p, *fn;
PoolMem Digest(PM_MESSAGE); /* Either Verify opts or MD5/SHA1 digest */

Digest.check_size(fd->message_length);
if ((len = sscanf(fd->msg, "%ld %d %s", &file_index, &stream,
Digest.c_str())) != 3) {
Jmsg(jcr, M_FATAL, 0,
Expand Down

0 comments on commit 1faaffa

Please sign in to comment.