Re: [PATCH 1/4] stringbuf: A string buffer implementation

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Kyle Moffett
Date: Wednesday, October 24, 2007 - 5:07 pm

On Oct 24, 2007, at 17:21:10, Matthew Wilcox wrote:

No, the problem is what happens when you don't have enough space  
allocated:  you call "vsnprintf(s, len, format, args);" and then  
later call "vsprintf(s, format, args);" with the *SAME* "args".   
That's what's broken.

So this is wrong:

To fix it, you have 2 options.

Option 1:

Option 2:

Now in a function which *receives* a va_list from one of its callers,  
"Option 1" isn't an option because you don't have the original stack  
frame, so the result looks like this:


Cheers,
Kyle Moffett

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Stringbuf, v2, Matthew Wilcox, (Wed Oct 24, 12:58 pm)
[PATCH 1/4] stringbuf: A string buffer implementation, Matthew Wilcox, (Wed Oct 24, 12:59 pm)
[PATCH 2/4] isdn: Use stringbuf, Matthew Wilcox, (Wed Oct 24, 12:59 pm)
[PATCH 3/4] sound: Use stringbuf, Matthew Wilcox, (Wed Oct 24, 12:59 pm)
[PATCH 4/4] partitions: Fix non-atomic printk, Matthew Wilcox, (Wed Oct 24, 12:59 pm)
Re: Stringbuf, v2, Joe Perches, (Wed Oct 24, 1:51 pm)
Re: Stringbuf, v2, Matthew Wilcox, (Wed Oct 24, 1:57 pm)
Re: Stringbuf, v2, Joe Perches, (Wed Oct 24, 2:06 pm)
Re: [PATCH 1/4] stringbuf: A string buffer implementation, Matthew Wilcox, (Wed Oct 24, 2:21 pm)
Re: Stringbuf, v2, Matthew Wilcox, (Wed Oct 24, 2:34 pm)
Re: [PATCH 1/4] stringbuf: A string buffer implementation, Kyle Moffett, (Wed Oct 24, 5:07 pm)
Re: [PATCH 1/4] stringbuf: A string buffer implementation, Matthew Wilcox, (Wed Oct 24, 8:23 pm)
Re: [PATCH 1/4] stringbuf: A string buffer implementation, Rusty Russell, (Thu Oct 25, 7:11 pm)
Re: [PATCH 1/4] stringbuf: A string buffer implementation, Matthew Wilcox, (Fri Oct 26, 4:57 am)
Re: [PATCH 1/4] stringbuf: A string buffer implementation, Rusty Russell, (Sat Oct 27, 3:09 am)
Re: [PATCH 1/4] stringbuf: A string buffer implementation, Rusty Russell, (Sat Oct 27, 5:50 am)
Re: [PATCH 1/4] stringbuf: A string buffer implementation, Matthew Wilcox, (Sat Oct 27, 9:48 am)
Re: [PATCH 1/4] stringbuf: A string buffer implementation, Rusty Russell, (Sun Oct 28, 10:38 pm)