Re: [libvirt] [PATCH] phyp: Fixing possible buffer overflow

2010-08-06 Thread Laine Stump
On 08/05/2010 10:09 PM, Eric Blake wrote: On 08/05/2010 07:49 PM, Laine Stump wrote: +if (virStrToLong_i(line,&next_line, 10,&ids[got]) == -1) { +VIR_ERROR(_("Cannot parse number from '%s'"), line); +got = -1; +goto err; err: VIR_FREE(cmd)

Re: [libvirt] [PATCH] phyp: Fixing possible buffer overflow

2010-08-06 Thread Eduardo Otubo
On 08/05/2010 04:04 PM, Laine Stump wrote: On 08/04/2010 03:00 PM, Eduardo Otubo wrote: Hello Laine, It's been quite a while since we had this discussion about my patch. Sorry about the delay on replaying, I had a congress and I've been sick in the last couple of days. Now going back to work. :

Re: [libvirt] [PATCH] phyp: Fixing possible buffer overflow

2010-08-05 Thread Eric Blake
On 08/05/2010 07:49 PM, Laine Stump wrote: >>> +if (virStrToLong_i(line,&next_line, 10,&ids[got]) == -1) { >>> +VIR_ERROR(_("Cannot parse number from '%s'"), line); >>> +got = -1; >>> +goto err; >>> err: >>> VIR_FREE(cmd); >>> VIR_FREE(ret

Re: [libvirt] [PATCH] phyp: Fixing possible buffer overflow

2010-08-05 Thread Laine Stump
On 08/05/2010 04:34 PM, Eric Blake wrote: On 07/15/2010 08:01 PM, Laine Stump wrote: Here's a stab at doing it this way. I haven't even compiled it, but you can give it a try and see if it solves your problem. I _have_ compiled it, and double-checked it for any obvious logic flaws. There's a

Re: [libvirt] [PATCH] phyp: Fixing possible buffer overflow

2010-08-05 Thread Eric Blake
On 07/15/2010 08:01 PM, Laine Stump wrote: > Here's a stab at doing it this way. I haven't even compiled it, but > you can give it a try and see if it solves your problem. I _have_ compiled it, and double-checked it for any obvious logic flaws. There's a subtle change in semantics: > +/* I n

Re: [libvirt] [PATCH] phyp: Fixing possible buffer overflow

2010-08-05 Thread Laine Stump
On 08/04/2010 03:00 PM, Eduardo Otubo wrote: Hello Laine, It's been quite a while since we had this discussion about my patch. Sorry about the delay on replaying, I had a congress and I've been sick in the last couple of days. Now going back to work. :-) (this new patch is corrupt and does

Re: [libvirt] [PATCH] phyp: Fixing possible buffer overflow

2010-08-04 Thread Eduardo Otubo
Hello Laine, It's been quite a while since we had this discussion about my patch. Sorry about the delay on replaying, I had a congress and I've been sick in the last couple of days. Now going back to work. :-) (this new patch is corrupt and doesn't apply. Not sure how you sent it, but I'm gu

Re: [libvirt] [PATCH] phyp: Fixing possible buffer overflow

2010-07-16 Thread Laine Stump
On 07/16/2010 03:04 AM, Eduardo Otubo wrote: On 07/15/2010 11:01 PM, Laine Stump wrote: On 07/15/2010 06:37 PM, Eduardo Otubo wrote: The line src/phyp/phyp_driver.c:427 was crashing by buffer overflow if the return of the command wasn't<=10. The highest number for a LPAR ID is 256 per machine,

Re: [libvirt] [PATCH] phyp: Fixing possible buffer overflow

2010-07-16 Thread Eduardo Otubo
On 07/15/2010 11:01 PM, Laine Stump wrote: On 07/15/2010 06:37 PM, Eduardo Otubo wrote: The line src/phyp/phyp_driver.c:427 was crashing by buffer overflow if the return of the command wasn't<=10. The highest number for a LPAR ID is 256 per machine, no need to allocate 10 bytes for it. So, adjus

Re: [libvirt] [PATCH] phyp: Fixing possible buffer overflow

2010-07-15 Thread Laine Stump
On 07/15/2010 06:37 PM, Eduardo Otubo wrote: > The line src/phyp/phyp_driver.c:427 was crashing by buffer overflow > if the return of the command wasn't <=10. The highest number for a > LPAR ID is 256 per machine, no need to allocate 10 bytes for it. So, > adjusting the correct size (+1 byte for th

[libvirt] [PATCH] phyp: Fixing possible buffer overflow

2010-07-15 Thread Eduardo Otubo
The line src/phyp/phyp_driver.c:427 was crashing by buffer overflow if the return of the command wasn't <=10. The highest number for a LPAR ID is 256 per machine, no need to allocate 10 bytes for it. So, adjusting the correct size (+1 byte for the '\n') and checking for errors. --- src/phyp/phyp_