Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Anders

Bug found in pvsnfmt_int

Recommended Posts

Hi Quasar, i didn't know where to post this, since you left the channel about 3 minutes before i found it.

    for (; len > 0; len--)
    {
        char n = POP();
        if (n <= 9)
        {
            **pinsertion = n + '0';
            *pinsertion += 1;
        }
        else
        {
            **pinsertion = n - 10 + char10;
            *pinsertion += 1;
        }
    }
    *nmax -= len;
the author seems to have forgotten that len will be 0 after the for loop is done, so *nmax (which contains the number of characters left in the buffer) is never decreased. the easy fix is to use a temp variable for the for loop.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×