From 39e999b3d331c08cafc53a376307d9dccde6c7a9 Mon Sep 17 00:00:00 2001 From: Karol Pawlowski Date: Mon, 25 Mar 2013 14:42:15 +0100 Subject: [PATCH] Buffer not null terminated [Issue#] N/A [Feature/Bug] N/A [Problem] The string buffer may not have a null terminator [Cause] Coverity warnings [Solution] Strings possible length decremented Change-Id: I6b505ce2b72c6de944c4fa6e7c2e21cce1aeea71 --- src/pkg-manager/backendlib.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pkg-manager/backendlib.cpp b/src/pkg-manager/backendlib.cpp index 53b2ba6..60eb9b0 100644 --- a/src/pkg-manager/backendlib.cpp +++ b/src/pkg-manager/backendlib.cpp @@ -347,12 +347,12 @@ int getWidgetDetailInfoFromPackage(const char* pkgPath, strncpy(pkg_detail_info->pkg_type, "wgt", PKG_TYPE_STRING_LEN_MAX); if (!configInfo.tizenPkgId.IsNull()) { strncpy(pkg_detail_info->pkgid, - DPL::ToUTF8String(*configInfo.tizenPkgId).c_str(), PKG_TYPE_STRING_LEN_MAX); + DPL::ToUTF8String(*configInfo.tizenPkgId).c_str(), PKG_TYPE_STRING_LEN_MAX - 1); } if (!configInfo.version.IsNull()) { strncpy(pkg_detail_info->version, DPL::ToUTF8String(*configInfo.version).c_str(), - PKG_VERSION_STRING_LEN_MAX); + PKG_VERSION_STRING_LEN_MAX - 1); } DPL::Optional name; @@ -376,7 +376,7 @@ int getWidgetDetailInfoFromPackage(const char* pkgPath, } if( !name.IsNull()) { - strncpy(pkg_detail_info->pkg_name, DPL::ToUTF8String(*name).c_str(), PKG_NAME_STRING_LEN_MAX); + strncpy(pkg_detail_info->pkg_name, DPL::ToUTF8String(*name).c_str(), PKG_NAME_STRING_LEN_MAX - 1); } if (!desc.IsNull()) { @@ -394,7 +394,7 @@ int getWidgetDetailInfoFromPackage(const char* pkgPath, if (!configInfo.authorName.IsNull()) { strncpy(pkg_detail_info->author, DPL::ToUTF8String(*configInfo.authorName).c_str(), - PKG_VALUE_STRING_LEN_MAX); + PKG_VALUE_STRING_LEN_MAX - 1); } std::string icon_name; -- 2.7.4