Skip to content

Commit

Permalink
ndmp: Add safechecks to bndmp_write_data_to_block
Browse files Browse the repository at this point in the history
When ndmp jobs are canceled, jcr->dcr is null.
We now check for that condition and do not dereference then.

Fixes #604: Cancel a NDMP Job causes the sd to crash
  • Loading branch information
pstorz authored and joergsteffens committed Jul 5, 2016
1 parent 0b77823 commit 59348b6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/stored/ndmp_tape.c
Expand Up @@ -343,6 +343,15 @@ static inline bool bndmp_write_data_to_block(JCR *jcr,
DCR *dcr = jcr->dcr;
POOLMEM *rec_data;

if (!dcr) {
Dmsg0(100, "No dcr defined, bailing out\n");
return retval;
}

if (!dcr->rec) {
Dmsg0(100, "No dcr->rec defined, bailing out\n");
return retval;
}
/*
* Keep track of the original data buffer and restore it on exit from this function.
*/
Expand Down

0 comments on commit 59348b6

Please sign in to comment.