aboutsummaryrefslogtreecommitdiff
path: root/miscutils/bbconfig.c
diff options
context:
space:
mode:
Diffstat (limited to 'miscutils/bbconfig.c')
-rw-r--r--miscutils/bbconfig.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/miscutils/bbconfig.c b/miscutils/bbconfig.c
index 9ab57876e..501349548 100644
--- a/miscutils/bbconfig.c
+++ b/miscutils/bbconfig.c
@@ -44,13 +44,22 @@ int bbconfig_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
44{ 44{
45#if ENABLE_FEATURE_COMPRESS_BBCONFIG 45#if ENABLE_FEATURE_COMPRESS_BBCONFIG
46 bunzip_data *bd; 46 bunzip_data *bd;
47 int i = start_bunzip(&bd, 47 int i;
48 jmp_buf jmpbuf;
49
50 /* Setup for I/O error handling via longjmp */
51 i = setjmp(jmpbuf);
52 if (i == 0) {
53 i = start_bunzip(&jmpbuf,
54 &bd,
48 /* src_fd: */ -1, 55 /* src_fd: */ -1,
49 /* inbuf: */ bbconfig_config_bz2, 56 /* inbuf: */ bbconfig_config_bz2,
50 /* len: */ sizeof(bbconfig_config_bz2)); 57 /* len: */ sizeof(bbconfig_config_bz2)
51 /* read_bunzip can longjmp to start_bunzip, and ultimately 58 );
52 * end up here with i != 0 on read data errors! Not trivial */ 59 }
53 if (!i) { 60 /* read_bunzip can longjmp and end up here with i != 0
61 * on read data errors! Not trivial */
62 if (i == 0) {
54 /* Cannot use xmalloc: will leak bd in NOFORK case! */ 63 /* Cannot use xmalloc: will leak bd in NOFORK case! */
55 char *outbuf = malloc_or_warn(sizeof(bbconfig_config)); 64 char *outbuf = malloc_or_warn(sizeof(bbconfig_config));
56 if (outbuf) { 65 if (outbuf) {