diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-11-25 14:16:24 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-11-25 14:16:24 +0100 |
commit | aa6e97f68d6c8d06f531d9b6bb462dc1c0720f77 (patch) | |
tree | 19167cebb8afe1c7e80f6339b330759d509fb38e /lib/ASN1.c | |
parent | 0ffd9af63f06998f76c6ef014fb2ebbfbe69c33a (diff) | |
download | libtasn1-aa6e97f68d6c8d06f531d9b6bb462dc1c0720f77.tar.gz libtasn1-aa6e97f68d6c8d06f531d9b6bb462dc1c0720f77.tar.bz2 libtasn1-aa6e97f68d6c8d06f531d9b6bb462dc1c0720f77.zip |
corrected possible buffer overflow in parser errors.
Diffstat (limited to 'lib/ASN1.c')
-rw-r--r-- | lib/ASN1.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -119,7 +119,7 @@ static unsigned int line_number; /* line number describing the parser position inside the file */ static char last_error[ASN1_MAX_ERROR_DESCRIPTION_SIZE] = ""; -static char last_error_token[ASN1_MAX_NAME_SIZE+1] = ""; /* used when expected errors occur */ +static char last_error_token[ASN1_MAX_ERROR_DESCRIPTION_SIZE+1] = ""; /* used when expected errors occur */ static char last_token[ASN1_MAX_NAME_SIZE+1] = ""; /* last token find in the file to parse before the 'parse error' */ @@ -3283,7 +3283,7 @@ _asn1_yyerror (const char *s) strcmp (last_token, "TeletexString") == 0 || strcmp (last_token, "BMPString") == 0) { - snprintf (last_error_token, ASN1_MAX_ERROR_DESCRIPTION_SIZE, + snprintf (last_error_token, sizeof(last_error_token), "%s", last_token); fprintf(stderr, "%s:%u: Warning: %s is a built-in ASN.1 type.\n", @@ -3294,7 +3294,7 @@ _asn1_yyerror (const char *s) if (result_parse != ASN1_NAME_TOO_LONG) { - snprintf (last_error, ASN1_MAX_ERROR_DESCRIPTION_SIZE, + snprintf (last_error, sizeof(last_error), "%s:%u: Error: %s near '%s'", file_name, line_number, s, last_token); result_parse = ASN1_SYNTAX_ERROR; |