diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2021-01-05 22:09:49 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2021-01-05 22:09:49 (GMT) |
commit | 2a429fde26212e8c8c9a5a44f9a4a06ee60a5208 (patch) | |
tree | d5456f3c83d1faffdda1784b04d3ae59efde5ae0 /tools/d2c/d2c.c | |
parent | e790ebee8ad78e91fc61738c5c40062ed36b1d44 (diff) |
Fortified the d2c compiler by checking asprint() return values.
Diffstat (limited to 'tools/d2c/d2c.c')
-rw-r--r-- | tools/d2c/d2c.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/d2c/d2c.c b/tools/d2c/d2c.c index fbf401e..96bb81a 100644 --- a/tools/d2c/d2c.c +++ b/tools/d2c/d2c.c @@ -198,7 +198,15 @@ int main(int argc, char **argv) break; case 'o': - asprintf(&info.opcodes_dir, "%sopcodes%c", optarg, optarg[strlen(optarg) - 1]); + + ret = asprintf(&info.opcodes_dir, "%sopcodes%c", optarg, optarg[strlen(optarg) - 1]); + + if (ret == -1) + { + info.opcodes_dir = NULL; + fprintf(stderr, "unable to memorize the specified main output directory; exiting...\n"); + goto exit; + } break; case 't': |