From: Sean Bright Date: Mon, 1 Oct 2012 17:27:57 +0000 (+0000) Subject: Use ast_copy_string instead of strncpy to guarantee a NUL terminated string. X-Git-Tag: 11.0.0-rc1~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0dd8b496cf383d5f87378d1e9ee173620ffdc4a2;p=thirdparty%2Fasterisk.git Use ast_copy_string instead of strncpy to guarantee a NUL terminated string. ........ Merged revisions 374132 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@374133 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/db.c b/main/db.c index 42a4b9c65d..32af905689 100644 --- a/main/db.c +++ b/main/db.c @@ -332,7 +332,7 @@ int ast_db_get(const char *family, const char *key, char *value, int valuelen) ast_log(LOG_WARNING, "Couldn't get value\n"); res = -1; } else { - strncpy(value, (const char *) result, valuelen); + ast_copy_string(value, (const char *) result, valuelen); } sqlite3_reset(get_stmt); ast_mutex_unlock(&dblock);