Skip to content

Commit

Permalink
Dir crashes if media.ScratchPoolId = NULL
Browse files Browse the repository at this point in the history
Wrong array indices while checking for NULL corrected.

Fixes #469: Dir crashes if media.ScratchPoolId = NULL

Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
  • Loading branch information
Andreas Helmcke authored and Marco van Wieringen committed May 19, 2015
1 parent 55fbc8c commit 235a2e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -12,6 +12,7 @@ Alexander Bergolth
Alexandre Baron
Alexandre Simon
Allan Black
Andreas Helmcke
Andreas Piesk
Andrew Ford
Arno Lehmann
Expand Down
8 changes: 4 additions & 4 deletions src/cats/sql_get.c
Expand Up @@ -331,8 +331,8 @@ bool db_get_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
jr->JobId = str_to_int64(row[16]);
}
jr->FileSetId = str_to_int64(row[17]);
bstrncpy(jr->cSchedTime, (row[3] != NULL) ? row[18] : "", sizeof(jr->cSchedTime));
bstrncpy(jr->cRealEndTime, (row[3] != NULL) ? row[19] : "", sizeof(jr->cRealEndTime));
bstrncpy(jr->cSchedTime, (row[18] != NULL) ? row[18] : "", sizeof(jr->cSchedTime));
bstrncpy(jr->cRealEndTime, (row[19] != NULL) ? row[19] : "", sizeof(jr->cRealEndTime));
jr->ReadBytes = str_to_int64(row[20]);
jr->StartTime = str_to_utime(jr->cStartTime);
jr->SchedTime = str_to_utime(jr->cSchedTime);
Expand Down Expand Up @@ -1071,13 +1071,13 @@ bool db_get_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
mr->EndFile = str_to_uint64(row[23]);
mr->EndBlock = str_to_uint64(row[24]);
mr->LabelType = str_to_int64(row[25]);
bstrncpy(mr->cLabelDate, (row[26] != NULL) ? row[27] : "", sizeof(mr->cLabelDate));
bstrncpy(mr->cLabelDate, (row[26] != NULL) ? row[26] : "", sizeof(mr->cLabelDate));
mr->LabelDate = (time_t)str_to_utime(mr->cLabelDate);
mr->StorageId = str_to_int64(row[27]);
mr->Enabled = str_to_int64(row[28]);
mr->LocationId = str_to_int64(row[29]);
mr->RecycleCount = str_to_int64(row[30]);
bstrncpy(mr->cInitialWrite, (row[31] != NULL) ? row[32] : "", sizeof(mr->cInitialWrite));
bstrncpy(mr->cInitialWrite, (row[31] != NULL) ? row[31] : "", sizeof(mr->cInitialWrite));
mr->InitialWrite = (time_t)str_to_utime(mr->cInitialWrite);
mr->ScratchPoolId = str_to_int64(row[32]);
mr->RecyclePoolId = str_to_int64(row[33]);
Expand Down

0 comments on commit 235a2e7

Please sign in to comment.