Changeset 137:a3f5322e9940 in rrlib_logging


Ignore:
Timestamp:
18.09.2018 17:04:07 (22 months ago)
Author:
Tobias Föhst <foehst@…>
Branch:
14.08
Children:
138:3f36aecec7c5, 139:43ee24d738d5, 141:df696adabe8f
Phase:
public
Message:

Bugfix: using correct buffer size when determining length of printf-strings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • messages/implementation.h

    r113 r137  
    170170  va_start(printf_args0, fmt); 
    171171  char temp; 
    172   int needed_buffer_size = vsnprintf(&temp, 1, fmt, printf_args0); 
     172  int needed_buffer_size = vsnprintf(&temp, 0, fmt, printf_args0); 
    173173  va_end(printf_args0); 
     174  if (needed_buffer_size <= 0) 
     175  { 
     176    return; 
     177  } 
    174178 
    175179  va_list printf_args1; 
Note: See TracChangeset for help on using the changeset viewer.