[libvirt] [PATCH 7/9] Separate out code for sending tunnelled data

Daniel P. Berrange berrange at redhat.com
Mon Oct 5 14:16:02 UTC 2009


On Mon, Oct 05, 2009 at 03:29:47PM +0200, Paolo Bonzini wrote:
> On 10/05/2009 01:44 PM, Daniel P. Berrange wrote:
> >+    char buffer[65536];
> >+    int nbytes = sizeof(buffer);
> 
> I just noticed this, it's safer to malloc such a big array  (it is 
> actually from Chris patch, but you may take the opportunity to fix it).

Yes, that's a good point. 

Someday we should also consider getting rid of every occurrance of

  char buf[PATH_MAX]

since POSIX doesn't require PATH_MAX to be defined, and explicitly allows
it to have a value so large that it could never be allocated on the stack
or heap. Though its unlikely that we'd come across such an OS, its good
to avoid potentially large stack arrays.


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list