diff options
author | Ron Yorston <rmy@pobox.com> | 2018-04-09 08:50:34 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2018-04-09 08:50:34 +0100 |
commit | 921c1ab66bad54d4ad8591bb74e41ac985248496 (patch) | |
tree | 552a04c691e78e78570e4ec2c83fbc0e59953924 /miscutils/bbconfig.c | |
parent | 5b6f06f5eb8628955262508d153627fe6f2d1c8b (diff) | |
parent | a1870f4807a75663a085c9f5e92870fa7554f0ad (diff) | |
download | busybox-w32-921c1ab66bad54d4ad8591bb74e41ac985248496.tar.gz busybox-w32-921c1ab66bad54d4ad8591bb74e41ac985248496.tar.bz2 busybox-w32-921c1ab66bad54d4ad8591bb74e41ac985248496.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'miscutils/bbconfig.c')
-rw-r--r-- | miscutils/bbconfig.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/miscutils/bbconfig.c b/miscutils/bbconfig.c index 2151c622c..aa42de648 100644 --- a/miscutils/bbconfig.c +++ b/miscutils/bbconfig.c | |||
@@ -45,13 +45,22 @@ int bbconfig_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
45 | { | 45 | { |
46 | #if ENABLE_FEATURE_COMPRESS_BBCONFIG | 46 | #if ENABLE_FEATURE_COMPRESS_BBCONFIG |
47 | bunzip_data *bd; | 47 | bunzip_data *bd; |
48 | int i = start_bunzip(&bd, | 48 | int i; |
49 | jmp_buf jmpbuf; | ||
50 | |||
51 | /* Setup for I/O error handling via longjmp */ | ||
52 | i = setjmp(jmpbuf); | ||
53 | if (i == 0) { | ||
54 | i = start_bunzip(&jmpbuf, | ||
55 | &bd, | ||
49 | /* src_fd: */ -1, | 56 | /* src_fd: */ -1, |
50 | /* inbuf: */ bbconfig_config_bz2, | 57 | /* inbuf: */ bbconfig_config_bz2, |
51 | /* len: */ sizeof(bbconfig_config_bz2)); | 58 | /* len: */ sizeof(bbconfig_config_bz2) |
52 | /* read_bunzip can longjmp to start_bunzip, and ultimately | 59 | ); |
53 | * end up here with i != 0 on read data errors! Not trivial */ | 60 | } |
54 | if (!i) { | 61 | /* read_bunzip can longjmp and end up here with i != 0 |
62 | * on read data errors! Not trivial */ | ||
63 | if (i == 0) { | ||
55 | /* Cannot use xmalloc: will leak bd in NOFORK case! */ | 64 | /* Cannot use xmalloc: will leak bd in NOFORK case! */ |
56 | char *outbuf = malloc_or_warn(sizeof(bbconfig_config)); | 65 | char *outbuf = malloc_or_warn(sizeof(bbconfig_config)); |
57 | if (outbuf) { | 66 | if (outbuf) { |