<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><style type="text/css" scoped="">
@page { size: 21cm 29.7cm; margin: 2cm }
p { margin-bottom: 0.25cm; direction: ltr; color: #000000; line-height: 115%; text-align: left; orphans: 2; widows: 2; background: transparent }
p.western { font-family: "Calibri", serif; font-size: 11pt; so-language: ru-RU }
p.cjk { font-family: "Calibri"; font-size: 11pt; so-language: en-US }
p.ctl { font-family: "Tahoma"; font-size: 11pt; so-language: ar-SA }
</style><style type="text/css" scoped="">
@page { size: 21cm 29.7cm; margin: 2cm }
p { margin-bottom: 0.25cm; direction: ltr; color: #000000; line-height: 115%; text-align: left; orphans: 2; widows: 2; background: transparent }
p.western { font-family: "Calibri", serif; font-size: 11pt; so-language: ru-RU }
p.cjk { font-family: "Calibri"; font-size: 11pt; so-language: en-US }
p.ctl { font-family: "Tahoma"; font-size: 11pt; so-language: ar-SA }
</style><style type="text/css" scoped="">
@page { size: 21cm 29.7cm; margin: 2cm }
p { margin-bottom: 0.25cm; direction: ltr; color: #000000; line-height: 115%; text-align: left; orphans: 2; widows: 2; background: transparent }
p.western { font-family: "Calibri", serif; font-size: 11pt; so-language: ru-RU }
p.cjk { font-family: "Calibri"; font-size: 11pt; so-language: en-US }
p.ctl { font-family: "Tahoma"; font-size: 11pt; so-language: ar-SA }
</style><div><pre>Package: bacula</pre><div>Version: 9.6.7-3<br><br><br>Hi.<br><br>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. <br>Segmentation fault<br><br><pre class="tw-data-text tw-text-large tw-ta" data-placeholder="Перевод" id="tw-target-text" style="text-align: left;" data-mce-style="text-align: left;"><span class="Y2IQFc" lang="en">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".</span></pre><div><span class="Y2IQFc" lang="en">System information: Linux debian 5.10.0-12-amd64 #1 SMP Debian 5.10.103-1 (2022-03-07) x86_64 GNU/Linux<br>libc-2.31.so</span></div><div><span class="Y2IQFc" lang="en"><span class="Y2IQFc" lang="en"><br>CWE identifier for this bug: </span></span><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;">CWE-476 NULL Pointer Dereference<br><br>Code fragment where bug appearance:</span></span></span><p class="western" style="margin: 0px; line-height: 100%;" data-mce-style="margin: 0px; line-height: 100%;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;">I</span></span><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;">n some moments program bsdjson call function check_resources(bsdjson.c:521). In </span></span><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;">if(!</span></span><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;">me->messages</span></span><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;">) (</span></span><span style="color: #000000;" data-mce-style="color: #000000;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="ru-RU">file</span></span></span></span><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"> </span></span><span style="color: #000000;" data-mce-style="color: #000000;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="en-US">bsdjson</span></span></span></span><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;">.</span></span><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="en-US">c</span></span></span><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;">:</span></span><span style="color: #000000;" data-mce-style="color: #000000;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="ru-RU">551</span></span></span></span><span style="color: #000000;" data-mce-style="color: #000000;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="ru-RU">) </span></span></span></span><span style="color: #000000;" data-mce-style="color: #000000;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="ru-RU">and</span></span></span></span><span style="color: #000000;" data-mce-style="color: #000000;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="ru-RU"> </span></span></span></span><span style="color: #000000;" data-mce-style="color: #000000;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="ru-RU">if(!</span></span></span></span><span style="color: #000000;" data-mce-style="color: #000000;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="ru-RU">me->working_directory)</span></span></span></span><span style="color: #000000;" data-mce-style="color: #000000;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="ru-RU">(</span></span></span></span><span style="color: #000000;" data-mce-style="color: #000000;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="ru-RU">file</span></span></span></span><span style="color: #000000;" data-mce-style="color: #000000;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="ru-RU"> </span></span></span></span><span style="color: #000000;" data-mce-style="color: #000000;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="en-US">bsdjson</span></span></span></span><span style="color: #000000;" data-mce-style="color: #000000;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="ru-RU">.</span></span></span></span><span style="color: #000000;" data-mce-style="color: #000000;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="en-US">c</span></span></span></span><span style="color: #000000;" data-mce-style="color: #000000;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="ru-RU">:</span></span></span></span><span style="color: #000000;" data-mce-style="color: #000000;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="ru-RU">560</span></span></span></span><span style="color: #000000;" data-mce-style="color: #000000;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="ru-RU">) </span></span></span></span><span style="color: #000000;" data-mce-style="color: #000000;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="ru-RU">because of </span></span></span></span><span style="color: #000000;" data-mce-style="color: #000000;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="ru-RU">NULL Pointer Dereference </span></span></span></span><span style="color: #000000;" data-mce-style="color: #000000;"><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="ru-RU">appearance undefined program behavior. In this bug - «Segmentation fault»<br><br></span></span></span></span>Way to fix this bug:</p><p class="western" style="margin: 0px; line-height: 115%;" data-mce-style="margin: 0px; line-height: 115%;"><span style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;">Problem can be solved by correcting «if». For example:</span></span></p><p class="western" style="margin: 0px; line-height: 100%;" data-mce-style="margin: 0px; line-height: 100%;"><span style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span style="background: transparent;" data-mce-style="background: transparent;">if(</span></span></span><span style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span style="background: transparent;" data-mce-style="background: transparent;">me && </span></span></span><span style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span style="background: transparent;" data-mce-style="background: transparent;">!me→messages)</span></span></span></p><p class="western" style="margin: 0px; line-height: 100%;" data-mce-style="margin: 0px; line-height: 100%;"><span style="color: #000000;"><span style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="ru-RU"><span style="background: transparent;" data-mce-style="background: transparent;">f(</span></span></span></span></span><span style="color: #000000;"><span style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="ru-RU"><span style="background: transparent;" data-mce-style="background: transparent;">me && </span></span></span></span></span><span style="color: #000000;"><span style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="ru-RU"><span style="background: transparent;" data-mce-style="background: transparent;">!</span></span></span></span></span><span style="color: #000000;"><span style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><span lang="ru-RU"><span style="background: transparent;" data-mce-style="background: transparent;">me->working_directory)</span></span></span></span></span></p><span style="font-family: PT Astra Serif, serif;" data-mce-style="font-family: PT Astra Serif, serif;"><span style="font-size: medium;" data-mce-style="font-size: medium;"><br>Regards,<br><br>Shahov Erik<br></span></span><span class="Y2IQFc" lang="en"><span class="Y2IQFc" lang="en"></span></span></div></div></div></div></body></html>