diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-11-10 00:18:37 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-11-10 00:18:37 +0100 |
commit | a26e0f5c84405ba760022749984bb73f1d548431 (patch) | |
tree | 40f045a9a2bd8d5ee1fece665fd5e33a0e53b200 /src/asn1Coding.c | |
parent | 708e5101fa8b1d4ee2b1dc8247216ea34182a963 (diff) | |
download | libtasn1-a26e0f5c84405ba760022749984bb73f1d548431.tar.gz libtasn1-a26e0f5c84405ba760022749984bb73f1d548431.tar.bz2 libtasn1-a26e0f5c84405ba760022749984bb73f1d548431.zip |
Check for errors reading the assignment file in asn1Coding.
src/asn1Coding.c: Check the value returned by readAssignment ()
to be either ASSIGNMENT_SUCCESS or ASSIGNMENT_EOF.
Patch by Ivan Shmakov.
Diffstat (limited to 'src/asn1Coding.c')
-rw-r--r-- | src/asn1Coding.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/asn1Coding.c b/src/asn1Coding.c index 0a6a996..700e958 100644 --- a/src/asn1Coding.c +++ b/src/asn1Coding.c @@ -144,6 +144,7 @@ main (int argc, char *argv[]) unsigned char *der = NULL; int der_len; int k; + int last_ra; set_program_name (argv[0]); @@ -248,7 +249,8 @@ main (int argc, char *argv[]) putc ('\n', stderr); - while (readAssignment (inputFile, varName, value) == ASSIGNMENT_SUCCESS) + while ((last_ra = readAssignment (inputFile, varName, value)) + == ASSIGNMENT_SUCCESS) { fprintf (stderr, "var=%s, value=%s\n", varName, value); if (structure == NULL) @@ -273,6 +275,11 @@ main (int argc, char *argv[]) exit (1); } } + if (last_ra != ASSIGNMENT_EOF) + { + fprintf (stderr, "asn1Coding: error reading assignment file\n"); + exit (1); + } fclose (inputFile); putc ('\n', stderr); |