Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make sure we don't went out of the string to handle *before* using it (thx valgrind)
[simgrid.git] / src / xbt / xbt_str.c
index 973ac6a..aa61389 100644 (file)
@@ -60,7 +60,7 @@ xbt_str_rtrim(char* s, const char* char_list)
        while(*cur)
                ++cur;
 
        while(*cur)
                ++cur;
 
-       while(white_char[(unsigned char)*cur] && (cur >= s))
+       while((cur >= s) && white_char[(unsigned char)*cur])
                --cur;
 
        *++cur = '\0';
                --cur;
 
        *++cur = '\0';