From 3b7ebc7c025fe9ee9a5e41927fd1ed7f95e0ec50 Mon Sep 17 00:00:00 2001 From: okir Date: Sat, 21 Dec 2002 14:10:36 +0000 Subject: [PATCH] - clarified use of conf_blocks in process_config_file git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@803 c6295689-39f2-0310-b995-f0e70906c6a9 --- src/libopensc/ctx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libopensc/ctx.c b/src/libopensc/ctx.c index 29781321..125d93b3 100644 --- a/src/libopensc/ctx.c +++ b/src/libopensc/ctx.c @@ -323,6 +323,7 @@ void process_config_file(struct sc_context *ctx, struct _sc_ctx_options *opts) int i, r, count = 0; scconf_block **blocks; + memset(ctx->conf_blocks, 0, sizeof(ctx->conf_blocks)); ctx->conf = scconf_new(OPENSC_CONF_PATH); if (ctx->conf == NULL) return; @@ -342,7 +343,9 @@ void process_config_file(struct sc_context *ctx, struct _sc_ctx_options *opts) ctx->conf_blocks[count++] = blocks[0]; free(blocks); } - for (i = 0; i < count; i++) + /* Above we add 2 blocks at most, but conf_blocks has 3 elements, + * so at least one is NULL */ + for (i = 0; ctx->conf_blocks[i]; i++) load_parameters(ctx, ctx->conf_blocks[i], opts); }