From: Sean Bright Date: Mon, 1 Oct 2012 17:27:22 +0000 (+0000) Subject: Use ast_copy_string instead of strncpy to guarantee a NUL terminated string. X-Git-Tag: 10.10.0-rc1~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c11151084acf1b25eab8d07137774eee082571a4;p=thirdparty%2Fasterisk.git Use ast_copy_string instead of strncpy to guarantee a NUL terminated string. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@374132 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/db.c b/main/db.c index 4a2455ce7c..ba02a249ce 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);