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 /libbb/appletlib.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 'libbb/appletlib.c')
-rw-r--r-- | libbb/appletlib.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 8fae11998..6a189a8c9 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c | |||
@@ -110,14 +110,21 @@ static const char *unpack_usage_messages(void) | |||
110 | char *outbuf = NULL; | 110 | char *outbuf = NULL; |
111 | bunzip_data *bd; | 111 | bunzip_data *bd; |
112 | int i; | 112 | int i; |
113 | jmp_buf jmpbuf; | ||
113 | 114 | ||
114 | i = start_bunzip(&bd, | 115 | /* Setup for I/O error handling via longjmp */ |
116 | i = setjmp(jmpbuf); | ||
117 | if (i == 0) { | ||
118 | i = start_bunzip(&jmpbuf, | ||
119 | &bd, | ||
115 | /* src_fd: */ -1, | 120 | /* src_fd: */ -1, |
116 | /* inbuf: */ packed_usage, | 121 | /* inbuf: */ packed_usage, |
117 | /* len: */ sizeof(packed_usage)); | 122 | /* len: */ sizeof(packed_usage) |
118 | /* read_bunzip can longjmp to start_bunzip, and ultimately | 123 | ); |
119 | * end up here with i != 0 on read data errors! Not trivial */ | 124 | } |
120 | if (!i) { | 125 | /* read_bunzip can longjmp and end up here with i != 0 |
126 | * on read data errors! Not trivial */ | ||
127 | if (i == 0) { | ||
121 | /* Cannot use xmalloc: will leak bd in NOFORK case! */ | 128 | /* Cannot use xmalloc: will leak bd in NOFORK case! */ |
122 | outbuf = malloc_or_warn(sizeof(UNPACKED_USAGE)); | 129 | outbuf = malloc_or_warn(sizeof(UNPACKED_USAGE)); |
123 | if (outbuf) | 130 | if (outbuf) |