aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/janitor-projects.txt12
-rw-r--r--include/asterisk/pbx.h14
-rw-r--r--main/dnsmgr.c5
3 files changed, 31 insertions, 0 deletions
diff --git a/doc/janitor-projects.txt b/doc/janitor-projects.txt
index 9d89ef18c..b111204f0 100644
--- a/doc/janitor-projects.txt
+++ b/doc/janitor-projects.txt
@@ -1,3 +1,15 @@
+ -- There a bunch of places where the result of pbx_builtin_getvar_helper()
+ gets stored and used. This is not threadsafe. This code should be replaced
+ with the following thread-safe version:
+
+ const char *var;
+
+ ast_channel_lock(chan);
+ if ((var = pbx_builtin_getvar_helper(chan, "MYVAR"))) {
+ var = ast_strdupa(var);
+ }
+ ast_channel_unlock(chan);
+
-- Convert all existing uses of astobj.h to astobj2.h
-- (chan_sip already in progress in a branch)
diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h
index 1ba9b0d70..1543de78d 100644
--- a/include/asterisk/pbx.h
+++ b/include/asterisk/pbx.h
@@ -806,6 +806,20 @@ int pbx_builtin_serialize_variables(struct ast_channel *chan, struct ast_str **b
/*!
* \note Will lock the channel.
+ *
+ * \note This function will return a pointer to the buffer inside the channel
+ * variable. This value should only be accessed with the channel locked. If
+ * the value needs to be kept around, it should be done by using the following
+ * thread-safe code:
+ * \code
+ * const char *var;
+ *
+ * ast_channel_lock(chan);
+ * if ((var = pbx_builtin_getvar_helper(chan, "MYVAR"))) {
+ * var = ast_strdupa(var);
+ * }
+ * ast_channel_unlock(chan);
+ * \endcode
*/
const char *pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name);
diff --git a/main/dnsmgr.c b/main/dnsmgr.c
index 0989f6315..19fd1baa7 100644
--- a/main/dnsmgr.c
+++ b/main/dnsmgr.c
@@ -21,6 +21,11 @@
* \brief Background DNS update manager
*
* \author Kevin P. Fleming <kpfleming@digium.com>
+ *
+ * \bug There is a minor race condition. In the event that an IP address
+ * of a dnsmgr managed host changes, there is the potential for the consumer
+ * of that address to access the in_addr data at the same time that the dnsmgr
+ * thread is in the middle of updating it to the new address.
*/
#include "asterisk.h"