diff options
author | midipix <writeonce@midipix.org> | 2015-12-04 21:23:24 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-11-10 23:35:30 -0500 |
commit | c61328dfece5c7346aabd4bc0027a9eb8126dd08 (patch) | |
tree | e36332656585bc244567949ec8b08df94ed60a94 /src/driver/pe_unit_ctx.c | |
parent | 88e83272a884b3acf62005a13d352781882f5cff (diff) | |
download | perk-c61328dfece5c7346aabd4bc0027a9eb8126dd08.tar.bz2 perk-c61328dfece5c7346aabd4bc0027a9eb8126dd08.tar.xz |
API redesign 4/10: pe_common_ctx: protect the common context structure against direct modification.
Diffstat (limited to 'src/driver/pe_unit_ctx.c')
-rw-r--r-- | src/driver/pe_unit_ctx.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/driver/pe_unit_ctx.c b/src/driver/pe_unit_ctx.c index bed99c6..b86719c 100644 --- a/src/driver/pe_unit_ctx.c +++ b/src/driver/pe_unit_ctx.c @@ -26,17 +26,17 @@ int pe_get_unit_ctx( if (!dctx || !(ctx = calloc(sizeof(*ctx),1))) return -1; - prot = (dctx->cctx.actflags & PERK_ACTION_MAP_READWRITE) + prot = (dctx->cctx->actflags & PERK_ACTION_MAP_READWRITE) ? PROT_READ | PROT_WRITE : PROT_READ; - if (pe_map_raw_image(dctx->cctx.fdin,path,prot,&ctx->map)) + if (pe_map_raw_image(dctx->cctx->fdin,path,prot,&ctx->map)) return pe_free_unit_ctx_impl(ctx,-1); if (pe_get_image_meta(&ctx->map,&ctx->meta)) return pe_free_unit_ctx_impl(ctx,-1); - memcpy(&ctx->cctx,&dctx->cctx, + memcpy(&ctx->cctx,dctx->cctx, sizeof(ctx->cctx)); ctx->path = path; |