[Asterisk-code-review] db: Notify user if deleted DB entry didn't exist. (asterisk[master])

Kevin Harwell asteriskteam at digium.com
Thu Jun 9 16:02:59 CDT 2022


Attention is currently required from: N A.
Kevin Harwell has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/18361 )

Change subject: db: Notify user if deleted DB entry didn't exist.
......................................................................


Patch Set 6: Code-Review-1

(2 comments)

File main/db.c:

https://gerrit.asterisk.org/c/asterisk/+/18361/comment/c81b36be_f2cf30ee 
PS6, Line 472: sizeof(value)
This should be sizeof(tmp). sizeof(value) takes the size of the pointer, which in all likelihood is larger than sizeof(tmp) will can then attempt to overwrite the end of the tmp array in db_get_common.

Also change this to ast_db_get as it'll handle the array to value pointer for you.


https://gerrit.asterisk.org/c/asterisk/+/18361/comment/d13f8bd3_38bec550 
PS6, Line 477: 	ast_mutex_lock(&dblock);
I _think_ the race condition mentioned still occurs as the following is still taking place:

lock
get
unlock
<stuff can happen in other threads>
lock
del
unlock

So either move this lock to before the 'db_get_common' call, or remove that call altogether and move some of the 'db_get_common' code into this function.

If going with the former I believe this call can then be converted to:
lock
ast_db_get
ast_deb_del
unlock



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18361
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ic84e3eddcd66c7a6ed7fea91cdfd402568378b18
Gerrit-Change-Number: 18361
Gerrit-PatchSet: 6
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Attention: N A <mail at interlinked.x10host.com>
Gerrit-Comment-Date: Thu, 09 Jun 2022 21:02:59 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220609/c2d0baba/attachment.html>


More information about the asterisk-code-review mailing list