From 4465cb48f6ceaba19083304729967cb65afabd5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Fri, 28 Sep 2018 17:54:49 +0200 Subject: [PATCH] [poincare] Use strcmp instead of strncmp --- ion/src/shared/storage.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ion/src/shared/storage.cpp b/ion/src/shared/storage.cpp index 55c99c1a7..a956ce159 100644 --- a/ion/src/shared/storage.cpp +++ b/ion/src/shared/storage.cpp @@ -170,7 +170,9 @@ Storage::Record Storage::recordBaseNamedWithExtensions(const char * baseName, co size_t nameLength = strlen(baseName); for (char * p : *this) { const char * currentName = fullNameOfRecordStarting(p); - if (strncmp(currentName, baseName, nameLength) == 0) { + /* To not add the method strncmp, we use strcmp and compare to the expected + * result. */ + if (strcmp(baseName, currentName) == 0 - currentName[nameLength]) { for (size_t i = 0; i < numberOfExtensions; i++) { if (strcmp(currentName+nameLength+1 /*+1 to pass the dot*/, extensions[i]) == 0) { return Record(currentName);