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 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) {