diff --git a/README.md b/README.md
index a53e7c7701..492df86da4 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
[![SOF support badge](https://nexus.lab.fiware.org/repository/raw/public/badges/stackoverflow/orion.svg)](http://stackoverflow.com/questions/tagged/fiware-orion)
[![NGSI v2](https://nexus.lab.fiware.org/repository/raw/public/badges/specifications/ngsiv2.svg)](http://fiware-ges.github.io/orion/api/v2/stable/)
-[![Documentation badge](https://img.shields.io/readthedocs/fiware-orion/2.4.0.svg)](https://fiware-orion.rtfd.io/en/2.4.0/)
+[![Documentation badge](https://img.shields.io/readthedocs/fiware-orion/2.4.1.svg)](https://fiware-orion.rtfd.io/en/2.4.1/)
[![Build badge](https://img.shields.io/travis/telefonicaid/fiware-orion.svg)](https://travis-ci.org/telefonicaid/fiware-orion/)
![Status](https://nexus.lab.fiware.org/static/badges/statuses/orion.svg)
diff --git a/rpm/SPECS/contextBroker.spec b/rpm/SPECS/contextBroker.spec
index c61000ca05..784862e736 100644
--- a/rpm/SPECS/contextBroker.spec
+++ b/rpm/SPECS/contextBroker.spec
@@ -176,6 +176,9 @@ if [ "$1" == "0" ]; then
fi
%changelog
+* Wed Sep 23 2020 Fermin Galan 2.4.1-1
+- Fix: potencial race condition related with DateTime attributes due to the usage of thread unsafe functions
+
* Tue Mar 31 2020 Fermin Galan 2.4.0-1
- Add: TextUnrestricted attribute type to avoid forbidden chars checking (#3550)
- Add: notification flow control on update (#3568)
diff --git a/src/app/contextBroker/version.h b/src/app/contextBroker/version.h
index 55dc674a30..c3f185b75d 100644
--- a/src/app/contextBroker/version.h
+++ b/src/app/contextBroker/version.h
@@ -28,6 +28,6 @@
-#define ORION_VERSION "2.4.0"
+#define ORION_VERSION "2.4.1"
#endif // SRC_APP_CONTEXTBROKER_VERSION_H_
diff --git a/src/lib/common/defaultValues.h b/src/lib/common/defaultValues.h
index da734b03d4..bbdf2ed0e7 100644
--- a/src/lib/common/defaultValues.h
+++ b/src/lib/common/defaultValues.h
@@ -41,6 +41,6 @@
*
* API Documentation - The link to the the GEri documentation, either in the gh-pages (.github.io/) inside the fiware organization in GitHub or ReadTheDocs manual.
*/
-#define API_DOC "https://fiware-orion.rtfd.io/en/2.4.0/"
+#define API_DOC "https://fiware-orion.rtfd.io/en/2.4.1/"
#endif // SRC_LIB_COMMON_DEFAULTVALUES_H_
diff --git a/src/lib/common/string.cpp b/src/lib/common/string.cpp
index 635c90d867..2700462ab5 100644
--- a/src/lib/common/string.cpp
+++ b/src/lib/common/string.cpp
@@ -1003,17 +1003,19 @@ std::string double2string(double f)
*
* isodate2str -
*
-* FIXME P6: change implementation to use gmtime_r
-*
*/
std::string isodate2str(long long timestamp)
{
// 80 bytes is enough to store any ISO8601 string safely
- // We use gmtime() to get UTC strings, otherwise we would use localtime()
+ // We use gmtime_r() to get UTC strings, otherwise we would use localtime()
// Date pattern: 1970-04-26T17:46:40.00Z
char buffer[80];
+
+ // Unused, but needed to fullfill gmtime_r() signature
+ struct tm tmP;
+
time_t rawtime = (time_t) timestamp;
- strftime(buffer, sizeof(buffer), "%Y-%m-%dT%H:%M:%S.00Z", gmtime(&rawtime));
+ strftime(buffer, sizeof(buffer), "%Y-%m-%dT%H:%M:%S.00Z", gmtime_r(&rawtime, &tmP));
return std::string(buffer);
}