bb11023 - Wrong declaration of function destroy_ctx to cause undefined behavior

pull/6/head
Shawn Webb 11 years ago
parent 91099b6c86
commit e0f667e7f1
  1. 4
      sigtool/sigtool.c
  2. 3
      sigtool/vba.c
  3. 2
      sigtool/vba.h

@ -1530,12 +1530,12 @@ static int vbadump(const struct optstruct *opts)
return -1;
}
if(cli_ole2_extract(dir, ctx, &vba)) {
destroy_ctx(ctx);
destroy_ctx(-1, ctx);
cli_rmdirs(dir);
free(dir);
return -1;
}
destroy_ctx(ctx);
destroy_ctx(-1, ctx);
if (vba)
sigtool_vba_scandir(dir, hex_output, vba);
cli_rmdirs(dir);

@ -93,7 +93,8 @@ cli_ctx *convenience_ctx(int fd) {
void destroy_ctx(int desc, cli_ctx *ctx) {
funmap(*(ctx->fmap));
close(desc);
if (desc >= 0)
close(desc);
free(ctx->fmap);
cl_engine_free((struct cl_engine *)ctx->engine);
free(ctx);

@ -25,6 +25,6 @@
int sigtool_vba_scandir(const char *dirname, int hex_output, struct uniq *U);
cli_ctx *convenience_ctx(int fd);
void destroy_ctx(cli_ctx *ctx);
void destroy_ctx(int desc, cli_ctx *ctx);
#endif

Loading…
Cancel
Save