View Issue Details

IDProjectCategoryView StatusLast Update
0006146Talerexchangepublic2020-04-02 11:40
ReporterfefeAssigned ToChristian Grothoff 
Status resolvedResolutionfixed 
Product Version0.7.0 
Target Version0.7.1Fixed in Version0.7.1 
Summary0006146: Taler exchange is multithreaded yet uses GNUNET_STRINGS_absolute_time_to_string
DescriptionGNUNET_STRINGS_absolute_time_to_string is not thread-safe. It returns a pointer to a static buffer, which is the same for all callers.
So if two threads call it simultaneously, the two callers will clobber each other's output into the buffer and return a garbled value.

Recommendation: add a GNUNET_STRINGS_absolute_time_to_string_r function that additionally takes a buffer and a buffer size as arguments.
Steps To Reproducegnunet-0.12.2/src/util/strings.c

 741 const char *
 742 GNUNET_STRINGS_absolute_time_to_string (struct GNUNET_TIME_Absolute t)
 743 {
 744 static char buf[255];

 759 return buf;
 760 }
TagsNo tags attached.


Christian Grothoff

2020-04-02 11:40

manager   ~0015489

Fixed in a4653a7a0..225ddf0a2 (gnunet.git) and d1bf2692..340ac361 (exchange.git) by adding missing GNUNET_THREAD_LOCAL for routines with such static buffers.

Issue History

Date Modified Username Field Change
2020-04-02 11:27 fefe New Issue
2020-04-02 11:27 fefe Status new => assigned
2020-04-02 11:27 fefe Assigned To => Christian Grothoff
2020-04-02 11:40 Christian Grothoff Note Added: 0015489
2020-04-02 11:40 Christian Grothoff Status assigned => resolved
2020-04-02 11:40 Christian Grothoff Resolution open => fixed
2020-04-02 11:40 Christian Grothoff Fixed in Version => 0.7.1
2020-04-02 11:40 Christian Grothoff Target Version => 0.7.1