Jump to content

Bug found in pvsnfmt_int


Anders

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...