Skip to content

Commit

Permalink
Merge pull request #1341 from FIWARE/clone/PR_1273
Browse files Browse the repository at this point in the history
Clone/pr 1273
  • Loading branch information
kzangeli authored Mar 17, 2023
2 parents 4532222 + 358b393 commit ef3f5b0
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@
* Issue #1322 Implemented better notification response reception and much better log messages
* Issue #1322 Default port for HTTPS is 443, for HTTP: 80
* Issue #1338 Removed the check for mongoc only, as all operations now support mongoc
* Issue #1340 Fixed a dangling pointer bug
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ ELSEIF (${DISTRO} MATCHES "Debian_9.*")
ELSEIF (${DISTRO} MATCHES "RedHat_8.*")
set (CMAKE_CXX_FLAGS "-Wall -Wno-unknown-pragmas -D_LARGEFILE64_SOURCE -DREDHAT_UBI=8.4 -D_GNU_SOURCE -Werror -Wno-deprecated-declarations -fno-var-tracking-assignments")
ELSE()
set (CMAKE_CXX_FLAGS "-Wall -Wno-unknown-pragmas -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -Werror -Wno-deprecated-declarations -fno-var-tracking-assignments")
set (CMAKE_CXX_FLAGS "-Wall -Wno-unknown-pragmas -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -Werror -Wno-deprecated-declarations -Wno-psabi -fno-var-tracking-assignments")
ENDIF ()

#
Expand Down
2 changes: 1 addition & 1 deletion src/lib/ngsi/Scope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ std::string Scope::check(void)
{
char noOfV[STRING_SIZE_FOR_INT];

snprintf(noOfV, sizeof(noOfV), "%lu", polygon.vertexList.size());
snprintf(noOfV, sizeof(noOfV), "%zu", polygon.vertexList.size());
std::string details = std::string("too few vertices for a polygon (") + noOfV + " is less than three)";
alarmMgr.badInput(clientIp, details);

Expand Down
7 changes: 6 additions & 1 deletion src/lib/orionld/mongoc/mongocEntityDelete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
*/
#include <mongoc/mongoc.h> // MongoDB C Client Driver

extern "C"
{
#include "kalloc/kaStrdup.h" // ksStrdup
}

#include "logMsg/logMsg.h" // LM_*

#include "orionld/common/orionldState.h" // orionldState
Expand Down Expand Up @@ -60,7 +65,7 @@ bool mongocEntityDelete(const char* entityId, char** detailP)
{
LM_E(("Database Error (mongoc_collection_remove returned %d.%d:%s)", error.domain, error.code, error.message));
orionldError(OrionldInternalError, "Database Error", error.message, 500);
*detailP = error.message;
*detailP = kaStrdup(&orionldState.kalloc, error.message);
return false;
}

Expand Down
12 changes: 6 additions & 6 deletions src/lib/orionld/rest/OrionLdRestService.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ typedef struct OrionLdRestServiceSimplifiedVector
#define ORIONLD_URIPARAM_NOTEXISTS (1 << 29)
#define ORIONLD_URIPARAM_RELATIONSHIPS (1 << 30)
#define ORIONLD_URIPARAM_GEOPROPERTIES (1 << 31)
#define ORIONLD_URIPARAM_LANGUAGEPROPERTIES (1UL << 32)
#define ORIONLD_URIPARAM_OBSERVEDAT (1UL << 33)
#define ORIONLD_URIPARAM_LANG (1UL << 34)
#define ORIONLD_URIPARAM_LOCAL (1UL << 35)
#define ORIONLD_URIPARAM_RESET (1UL << 36)
#define ORIONLD_URIPARAM_LEVEL (1UL << 37)
#define ORIONLD_URIPARAM_LANGUAGEPROPERTIES (UINT64_C(1) << 32)
#define ORIONLD_URIPARAM_OBSERVEDAT (UINT64_C(1) << 33)
#define ORIONLD_URIPARAM_LANG (UINT64_C(1) << 34)
#define ORIONLD_URIPARAM_LOCAL (UINT64_C(1) << 35)
#define ORIONLD_URIPARAM_RESET (UINT64_C(1) << 36)
#define ORIONLD_URIPARAM_LEVEL (UINT64_C(1) << 37)



Expand Down
2 changes: 1 addition & 1 deletion src/lib/rest/RestService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ std::string tenantCheck(const std::string& tenant)
char numV2[STRING_SIZE_FOR_LONG];

snprintf(numV1, sizeof(numV1), "%d", SERVICE_NAME_MAX_LEN);
snprintf(numV2, sizeof(numV2), "%lu", strlen(name));
snprintf(numV2, sizeof(numV2), "%zu", strlen(name));

std::string details = std::string("a tenant name can be max ") + numV1 + " characters long. Length: " + numV2;
alarmMgr.badInput(clientIp, details);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/rest/httpHeaderAdd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void httpHeaderLinkAdd(const char* _url)
}

urlLen = strlen(url);
if (urlLen > sizeof(link) + LINK_REL_AND_TYPE_SIZE + 5)
if (urlLen + LINK_REL_AND_TYPE_SIZE + 5 > sizeof(link))
{
linkP = (char*) malloc(urlLen + LINK_REL_AND_TYPE_SIZE + 5);
if (linkP == NULL)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/serviceRoutines/postSubscribeContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ std::string postSubscribeContext
if (ciP->servicePathV.size() > 1)
{
char noOfV[STRING_SIZE_FOR_LONG + 3];
snprintf(noOfV, sizeof(noOfV) - 1, "%lu", ciP->servicePathV.size());
snprintf(noOfV, sizeof(noOfV) - 1, "%zu", ciP->servicePathV.size());
orionldState.httpStatusCode = SccOk; // NGSIv1 is weird... it uses 200 OK at HTTP level for errors
std::string details = std::string("max *one* service-path allowed for subscriptions (") + noOfV + " given";

Expand Down

0 comments on commit ef3f5b0

Please sign in to comment.