Function that strips trailing '0's from a float
My thoughts are as follows:


Since you are leveraging snprintf, you have already limited the string size to buffer_size, so the additional condition in the while loop should not be needed.
Since there is no validation, I'm assuming the data has been validated before and that the value will never exceed buffer_size with, which allows for the following simplification:

int float_to_str(float f, char *output, int buffer_size)
{
    int buf_len = snprintf(output, buffer_size, "%0.5f", f);
    if(buf_len&gt;buffer_size) return -1 ; // updated to add validation
    //Strip trailing '0's from response
    while (buf_len&gt;0)
    {
        if (output[buf_len-1] == '0') // is the last char a zero?
        {
            output[buf_len-1]=0;  // null terminate the string
            buf_len--;  
        }
        else break;  // if this is not a zero, we are either at the . or a non zero digit
    }
    return buf_len;  
}

I'm not sure your code will return the correct result if the input is 300.00014, my initial thought is your output would be 300.00.