From: Russell Bryant Date: Tue, 4 Mar 2008 04:26:39 +0000 (+0000) Subject: Use ast_copy_string() instead of strncpy(), and use sizeof() instead of X-Git-Tag: 1.6.0-beta7~240 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=71173779dca6f759112e0bb5b430a99ce198cf19;p=thirdparty%2Fasterisk.git Use ast_copy_string() instead of strncpy(), and use sizeof() instead of a magic number git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105589 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/pbx.c b/main/pbx.c index 3c42a62336..ff39a8c665 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -3623,8 +3623,11 @@ static struct ast_context *find_context_locked(const char *context) { struct ast_context *c = NULL; struct fake_context item; - strncpy(item.name, context, 256); + + ast_copy_string(item.name, context, sizeof(item.name)); + ast_rdlock_contexts(); + c = ast_hashtab_lookup(contexts_tree,&item); #ifdef NOTNOW