diff options
author | Dariusz Michaluk <d.michaluk@samsung.com> | 2018-06-15 11:11:52 +0200 |
---|---|---|
committer | Dariusz Michaluk <d.michaluk@samsung.com> | 2018-06-15 11:11:52 +0200 |
commit | 9ec7943e548cce0a73bdd3805933248fcb0ee67c (patch) | |
tree | 3d2dddcfb0dcb05fb0b7e5a8247f75e6b430c257 /src/asn1Decoding.c | |
parent | a39386a3afe2d7e0cc717a49f970f53d974fda53 (diff) | |
download | libtasn1-9ec7943e548cce0a73bdd3805933248fcb0ee67c.tar.gz libtasn1-9ec7943e548cce0a73bdd3805933248fcb0ee67c.tar.bz2 libtasn1-9ec7943e548cce0a73bdd3805933248fcb0ee67c.zip |
Imported Upstream version 4.9upstream/4.9
Diffstat (limited to 'src/asn1Decoding.c')
-rw-r--r-- | src/asn1Decoding.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/asn1Decoding.c b/src/asn1Decoding.c index b52e791..078963e 100644 --- a/src/asn1Decoding.c +++ b/src/asn1Decoding.c @@ -142,14 +142,18 @@ main (int argc, char *argv[]) usage (EXIT_FAILURE); } - inputFileAsnName = (char *) malloc (strlen (argv[optind]) + 1); - strcpy (inputFileAsnName, argv[optind]); + inputFileAsnName = strdup(argv[optind]); + inputFileDerName = strdup(argv[optind + 1]); + typeName = strdup(argv[optind + 2]); - inputFileDerName = (char *) malloc (strlen (argv[optind + 1]) + 1); - strcpy (inputFileDerName, argv[optind + 1]); - - typeName = (char *) malloc (strlen (argv[optind + 2]) + 1); - strcpy (typeName, argv[optind + 2]); + if (!(inputFileAsnName && inputFileDerName && typeName)) + { + fprintf(stderr, "allocation failed\n"); + free(inputFileAsnName); + free(inputFileDerName); + free(typeName); + exit(1); + } asn1_result = asn1_parser2tree (inputFileAsnName, &definitions, errorDescription); |