[libfko] bug fix to apply ctx initialization check before attempting to use ctx-...
authorMichael Rash <mbr@cipherdyne.org>
Sun, 12 May 2013 19:02:31 +0000 (15:02 -0400)
committerMichael Rash <mbr@cipherdyne.org>
Sun, 12 May 2013 19:02:31 +0000 (15:02 -0400)
lib/fko_client_timeout.c

index abfe49b..6a62223 100644 (file)
@@ -36,7 +36,7 @@
 int
 fko_set_spa_client_timeout(fko_ctx_t ctx, const int timeout)
 {
-    int     old_msg_type = ctx->message_type;
+    int     old_msg_type;
 
     /* Context must be initialized.
     */
@@ -48,6 +48,8 @@ fko_set_spa_client_timeout(fko_ctx_t ctx, const int timeout)
     if(timeout < 0)
         return(FKO_ERROR_INVALID_DATA);
 
+    old_msg_type = ctx->message_type;
+
     ctx->client_timeout = timeout;
 
     ctx->state |= FKO_DATA_MODIFIED;