aboutsummaryrefslogtreecommitdiff
path: root/libbb/appletlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/appletlib.c')
-rw-r--r--libbb/appletlib.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index 022455da4..769b7881c 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -102,14 +102,21 @@ static const char *unpack_usage_messages(void)
102 char *outbuf = NULL; 102 char *outbuf = NULL;
103 bunzip_data *bd; 103 bunzip_data *bd;
104 int i; 104 int i;
105 jmp_buf jmpbuf;
105 106
106 i = start_bunzip(&bd, 107 /* Setup for I/O error handling via longjmp */
108 i = setjmp(jmpbuf);
109 if (i == 0) {
110 i = start_bunzip(&jmpbuf,
111 &bd,
107 /* src_fd: */ -1, 112 /* src_fd: */ -1,
108 /* inbuf: */ packed_usage, 113 /* inbuf: */ packed_usage,
109 /* len: */ sizeof(packed_usage)); 114 /* len: */ sizeof(packed_usage)
110 /* read_bunzip can longjmp to start_bunzip, and ultimately 115 );
111 * end up here with i != 0 on read data errors! Not trivial */ 116 }
112 if (!i) { 117 /* read_bunzip can longjmp and end up here with i != 0
118 * on read data errors! Not trivial */
119 if (i == 0) {
113 /* Cannot use xmalloc: will leak bd in NOFORK case! */ 120 /* Cannot use xmalloc: will leak bd in NOFORK case! */
114 outbuf = malloc_or_warn(sizeof(UNPACKED_USAGE)); 121 outbuf = malloc_or_warn(sizeof(UNPACKED_USAGE));
115 if (outbuf) 122 if (outbuf)