Just initialize to NULL before going forward.
Fixes:
CID 542426: (#1 of 1): Uninitialized pointer read (UNINIT)
21. uninit_use_in_call: Using uninitialized value script_config.diags when calling operator =
Change-Id: I4ed97e4fbeb371f04f0496565fa03b7b4a302e02
This doesn't yet do much in terms of memory management as it still uses
pointers for arrays and structs, but it does move management of strings
and blobs into the variant. Further refactoring will bring the full
benefits.
Add specialised == operator to avoid implicit conversions to temporary
AmArg.
Includes white space cleanups.
Change-Id: I1e4bce6b96c2187294044f9f2a30fa7013912139
Move from debian/rules into actual makefile. This is not Debian-specific
and needs to be set for a successful build.
Also it's not a preprocessor option, it's a C++ option.
Change-Id: I19be56f4e319778def5697b1fdbc77a9988ccb9b
Add missing initialisers and fix order.
In some cases the member was actually unused and could just be removed.
Change-Id: I0f0c927eb8271c35dcfd371f225847f62bea2812
Warned-by: Coverity
We are passing here null pointer (so `this->dlg->getCallid()`)
which isn't good.
Just use a default `WARN()` instead.
Fixes:
*** CID 549008: Null pointer dereferences (FORWARD_NULL)
/apps/sbc/CallLeg.cpp: 193 in CallLeg::CallLeg(const CallLeg*, AmSipDialog *, AmSipSubscription *)()
187
188 // enable OA for the purpose of hold request detection
189 if (dlg) {
190 dlg->setOAEnabled(true);
191 dlg->setOAForceSDP(false);
192 }
>>> CID 549008: Null pointer dereferences (FORWARD_NULL)
>>> Passing null pointer "this->dlg->getCallid()" to "c_str", which dereferences it.
[Note: The source code implementation of the function has been overridden by a builtin model.]
193 else ILOG_DLG(L_WARN, "can't enable OA!\n");
194
195 // code below taken from createCalleeSession
196
197 const AmSipDialog* caller_dlg = caller->dlg;
198
Change-Id: If1f62386c9a2d3f6df4a12a2b157802b8a0677fa
These are all instances of an object being put into a container just
before it goes out of scope. Use move semantics to avoid copying.
Change-Id: I9c40a56c4a67df2b8e244d51f068b50ec286f5bf
Warned-by: Coverity
Use a static cast to make sure we use the right type for
std::string::length()
Change-Id: I3b21146ca8898d7e1f3b35c83389d37eadac5ff6
Warned-by: Coverity
Make it more explicit that this is meant to set the flag instead of
doing a comparison with a typo.
Change-Id: I31a1a7f35b9072f157105f6c2acdd2caf9bea09a
Warned-by: Coverity
Make the way we get call-id when calling ILOG_DLG()
file specific, which allows to define locally
(within a target file) how to get the call-id value.
Change-Id: I4af87edf9d1ea52d9678b3354bc797cf1f5f0b54
Classes that inherit from both AmThread and AmEventHandler must inherit
from AmEventQueue first and from AmThread after. This is needed so that
the AmThread dtor is called first, which will trigger the thread to shut
down, which in turn makes sure nothing is waiting on the AmEventQueue's
condition variable.
Otherwise, if AmEventQueue is destroyed first while the corresponding
thread is still running and waiting on the condition variable, it will
be a deadlock.
With this, sems finally can shut down cleanly without having to be
killed by systemd.
Change-Id: I914455763b517c96561acb0b64fce26f127f44bc
Use a timed condition waiter instead of waiting forever. This is needed
to be able to react to a requested thread shutdown.
Change-Id: I062b6045d737eb16cab8f052375d81a1988e95e8
Use a manual lock to make read/write operations
to the `std::map<DSMModule*, void*> mods_hdls` safer.
Change-Id: I45fb46bab603e2817bd98cd99267ed813122e548
Just add the following flags,
which are affecting the usage in our newer functionality:
- ssl
- crypto
Change-Id: Ia3edf1b77316fd64f7f55a5d2600fee730a285b4
Take into account that par2, used to pass N-th
amount of parameters, is properly exploded into
separate string objects having no spaces and
escaped double-quotes. Otherwise resolution fails.
Fixes:
[runactions, DSMStateEngine.cpp:334] DEBUG: executing 'utils.playRingTone(0, $config.rbt_on, $config.rbt_off, $config.rbt_f, $config.rbt_f2)'
[str2int, AmUtils.cpp:353] DEBUG: str2i: unexpected char 0x24 in $config.rbt_off
[execute, ModUtils.cpp:554] WARNING: could not decipher ringtone parameter 1: ' $config.rbt_off', using default
[str2int, AmUtils.cpp:353] DEBUG: str2i: unexpected char 0x24 in $config.rbt_f
[execute, ModUtils.cpp:554] WARNING: could not decipher ringtone parameter 2: ' $config.rbt_f', using default
[str2int, AmUtils.cpp:353] DEBUG: str2i: unexpected char 0x24 in $config.rbt_f2
[execute, ModUtils.cpp:554] WARNING: could not decipher ringtone parameter 3: ' $config.rbt_f2', using default
[execute, ModUtils.cpp:560] DEBUG: Playing ringtone length 0, on 1000, off 4000, f 440, f2 480
Change-Id: Ifed353478464d8071b5ca64959a7d4de6c877c8f
New functions introduced for DSM API (mod_utils):
- encryptCodeAes128CBC()
- decryptCodeAes128CBC()
Will be used by the voucher DSM application to encrypt/decrypt
the code given by a subscriber when filling up the balance.
OpenSSL AES128 CBC is used as an algorithm.
(with default AES key size 16 bytes)
Required things to let it be working:
- base64 encoding/decoding (of binary raw data)
- padding based on default AES key size (16)
Change-Id: I4b47f49ebf4b61157c3a4631cd8302565c660bc3
Use overloading for the various flavours of str2int functions. This has
the benefit of automatically choosing the appropriate function for
aliased types that may be one or the other underlying type, such as
size_t.
Do a mass renaming of all relevant instances.
Change-Id: I7abb6b9031ee53332d2b04a6cba4a6cc667a4807
Properly handle in the second `setRegistrationTimer`'s
overloading, wheread peerings used to not get
an insertion of timer into own dedicated map.
Change-Id: Ib793ed6a6eb13447d27321eab59957d1bec2aabf
Don't re-use a stupid code to check the type each
time it needs to printed somewhere in logs.
Just use the macro function to handle this job.
Change-Id: I942f4f3b0730fa3c66ce6df10e0e1ff109e09bd5
Don't use std::string, because all multiple
conditions based on that in the code, make code
comparisons quite heavy in comparison to enum usage.
So just use enum type with default `TYPE_UNDEFINED`.
Refactor code accordingly and remove superfluous
code that now isn't required.
Change-Id: Icf29579cd3b93a1624854bd0a47610fc061c64e6
Before to actually do any work based on that
we have to check if it actually dereferences anything
reasonable.
Change-Id: I736b7f44c9702ac49fbab967f6baea2be5279d74
Just refactoring, no func changes.
Fixes things like:
*** CID 545192: Uninitialized members (UNINIT_CTOR)
/apps/db_reg_agent/DBRegAgent.cpp: 73 in RegTimer::RegTimer()()
67 }
68
69 long object_id = 0;
70 RegistrationActionEvent::RegAction action;
71 string type;
72
>>> CID 545192: Uninitialized members (UNINIT_CTOR)
>>> Non-static class member "action" is not initialized in this constructor nor in any functions that it calls.
73 RegTimer() {}
74 };
75
76 DBRegAgent::DBRegAgent(const string& _app_name)
77 : AmDynInvokeFactory(_app_name),
78 AmEventQueue(this),
Change-Id: If7fdf53918e711a6b3d262f496ab0e0a349da4b8
No need to always check for:
`type == TYPE_SUBSCRIBER || type == TYPE_UNDEFINED`
The type is either `TYPE_PEERING` or the rest
(subscriber, or if CSTA didn't point out the type
explicitly it's undefined, but then again it's
related to subscriber's type).
Refactor the code accordingly. No func changes.
Change-Id: I5f045b645c971ef309436a5d1c3a4dbc7f180045
Fixes:
Uninitialized pointer field (UNINIT_CTOR)
Non-static class member current_diag is not initialized
in this constructor nor in any functions that it calls.
Change-Id: I80fd5175edb68079e7b7da7a336bcc7f0e882016
Use smart pointers instead of handling with new/delete.
Fixes:
Resource leak (RESOURCE_LEAK)
leaked_storage: Variable rev going out of scope leaks the storage it points to.
Change-Id: I33dfe6c4a74a01774093dc500248c3ed613b5710
When handling `XMLRPC2DIServer` allocation,
first make sure to have the `XmlRpcServer`
and then do rest of processing (e.g.: `di_export`,
`di_method`, `registerMethods()` etc.)
Otherwise can lead to seg.faults when appealing
to objects via still non-allocated `XmlRpcServer`
object.
Change-Id: Id3395ce3e0d6f2de76ed8caa1a786a6e139a851b