Bug#1008978: bsdjson segmentation fault

2022-05-30 Thread Carsten Leonhardt
Control: forwarded -1 https://bugs.bacula.org/view.php?id=2669

> Error message: bacula-sd: bsdjson.c:530-0 No Storage resource defined in /. 
> Cannot continue. 05-апр 16:42 bacula-sd JobId 0: Error: bsdjson.c:530 No 
> Storage resource defined in /. Cannot continue. bacula-sd: bsdjson.c:541-0 No 
> Director resource defined in /. Cannot continue. 05-апр 16:42 bacula-sd JobId 
> 0: Error: bsdjson.c:541 No Director resource defined in /. Cannot continue. 
> bacula-sd: bsdjson.c:546-0 No Device resource defined in /. Cannot continue. 
> 05-апр 16:42 bacula-sd JobId 0: Error: bsdjson.c:546 No Device resource 
> defined in /. Cannot continue. 
> Segmentation fault 

Hi Эрик,

thanks for your bug report, I have forwared it to upstreams bug tracker.

Regards

Carsten



Bug#1008978: bsdjson segmentation fault

2022-04-05 Thread Эрик Шахов
Package: bacula 
Version: 9.6.7-3 


Hi. 

Error message: bacula-sd: bsdjson.c:530-0 No Storage resource defined in /. 
Cannot continue. 05-апр 16:42 bacula-sd JobId 0: Error: bsdjson.c:530 No 
Storage resource defined in /. Cannot continue. bacula-sd: bsdjson.c:541-0 No 
Director resource defined in /. Cannot continue. 05-апр 16:42 bacula-sd JobId 
0: Error: bsdjson.c:541 No Director resource defined in /. Cannot continue. 
bacula-sd: bsdjson.c:546-0 No Device resource defined in /. Cannot continue. 
05-апр 16:42 bacula-sd JobId 0: Error: bsdjson.c:546 No Device resource defined 
in /. Cannot continue. 
Segmentation fault 

To reproduce the bug we just need to install bacula and type command 
"/usr/sbin/bsdjson /". This command will abort with "segmentation fault". In 
normal way it must finish without "Segmentation fault". 
System information: Linux debian 5.10.0-12-amd64 #1 SMP Debian 5.10.103-1 
(2022-03-07) x86_64 GNU/Linux 
libc-2.31.so 

CWE identifier for this bug: CWE-476 NULL Pointer Dereference 

Code fragment where bug appearance: 

I n some moments program bsdjson call function check_resources(bsdjson.c:521). 
In if(! me->messages ) ( file bsdjson . c : 551 ) and if(! 
me->working_directory) ( file bsdjson . c : 560 ) because of NULL Pointer 
Dereference appearance undefined program behavior. In this bug - «Segmentation 
fault» 

Way to fix this bug: 

Problem can be solved by correcting «if». For example: 

if( me && !me→messages) 

f( me && ! me->working_directory) 
Regards, 

Shahov Erik