test: fix segfault in networkxml2argvtest
test: fix segfault in networkxml2argvtest

This bug resolves https://bugzilla.redhat.com/show_bug.cgi?id=810100

rpm builds for i686 were failing with a segfault in
networkxml2argvtest. Running under valgrind showed that a region of
memory was being referenced after it had been freed (as the result of
realloc - see the valgrind report in the BZ).

The problem (in replaceTokens() - added in commit 22ec60, meaning this
bug was in 0.9.10 and 0.9.11) was that the pointers token_start and
token_end were being computed based on the value of *buf, then *buf
was being realloc'ed (potentially moving it), then token_start and
token_end were used without recomputing them to account for movement
of *buf.

The solution is to change the code so that token_start and token_end
are offsets into *buf rather than pointers. This way there is only a
single pointer to the buffer, and nothing needs readjusting after a
realloc. (You may note that some uses of token_start/token_end didn't
need to be changed to add in "*buf +" - that's because there ended up
being a +*buf and -*buf which canceled each other out).

DV gets the credit for finding this bug and pointing out the valgrind
report.

novel/fbsd-libvirt,emaste/libvirt,andreabolognani/libvirt,dumbbell/libvirt,jfehlig/libvirt,iam-TJ/libvirt,warewolf/libvirt,andreabolognani/libvirt,crobinso/libvirt,jardasgit/libvirt,jeckersb/libvirt,warewolf/libvirt,VenkatDatta/libvirt,rmarwaha/libvirt1,wiedi/libvirt,warewolf/libvirt,eskultety/libvirt,agx/libvirt,emaste/libvirt,libvirt/libvirt,jeckersb/libvirt,nertpinx/libvirt,elmarco/libvirt,libvirt/libvirt,emaste/libvirt,elmarco/libvirt,emaste/libvirt,dumbbell/libvirt,rmarwaha/libvirt,foomango/libvirt,jeckersb/libvirt,jardasgit/libvirt,bjzhang/libvirt,shugaoye/libvirt,trainstack/libvirt,datto/libvirt,datto/libvirt,fabianfreyer/libvirt,taget/libvirt,siboulet/libvirt-openvz,eskultety/libvirt,datto/libvirt,iam-TJ/libvirt,rmarwaha/libvirt1,andreabolognani/libvirt,jfehlig/libvirt,foomango/libvirt,iam-TJ/libvirt,agx/libvirt,taget/libvirt,taget/libvirt,dumbbell/libvirt,rmarwaha/libvirt1,zippy2/libvirt,warewolf/libvirt,trainstack/libvirt,wiedi/libvirt,jardasgit/libvirt,novel/fbsd-libvirt,rlaager/libvirt,eskultety/libvirt,datto/libvirt,zippy2/libvirt,bjzhang/libvirt,novel/fbsd-libvirt,zhlcindy/libvirt-1.1.4-maintain,trainstack/libvirt,foomango/libvirt,rlaager/libvirt,emaste/libvirt,olafhering/libvirt,rmarwaha/libvirt1,cbosdo/libvirt,warewolf/libvirt,rmarwaha/libvirt,shugaoye/libvirt,jardasgit/libvirt,elmarco/libvirt,jeckersb/libvirt,eskultety/libvirt,warewolf/libvirt,rlaager/libvirt,elmarco/libvirt,jeckersb/libvirt,agx/libvirt,jeckersb/libvirt,rmarwaha/libvirt,iam-TJ/libvirt,rmarwaha/libvirt1,novel/fbsd-libvirt,fabianfreyer/libvirt,VenkatDatta/libvirt,nertpinx/libvirt,wiedi/libvirt,trainstack/libvirt,andreabolognani/libvirt,crobinso/libvirt,cbosdo/libvirt,iam-TJ/libvirt,foomango/libvirt,olafhering/libvirt,wiedi/libvirt,siboulet/libvirt-openvz,wiedi/libvirt,cbosdo/libvirt,siboulet/libvirt-openvz,zhlcindy/libvirt-1.1.4-maintain,rmarwaha/libvirt1,nertpinx/libvirt,fabianfreyer/libvirt,rmarwaha/libvirt,rlaager/libvirt,emaste/libvirt,novel/fbsd-libvirt,rlaager/libvirt,novel/fbsd-libvirt,crobinso/libvirt,cbosdo/libvirt,nertpinx/libvirt,VenkatDatta/libvirt,novel/fbsd-libvirt,jeckersb/libvirt,libvirt/libvirt,emaste/libvirt,dumbbell/libvirt,siboulet/libvirt-openvz,wiedi/libvirt,zippy2/libvirt,shugaoye/libvirt,eskultety/libvirt,zhlcindy/libvirt-1.1.4-maintain,agx/libvirt,taget/libvirt,rmarwaha/libvirt,elmarco/libvirt,iam-TJ/libvirt,trainstack/libvirt,foomango/libvirt,agx/libvirt,fabianfreyer/libvirt,olafhering/libvirt,trainstack/libvirt,warewolf/libvirt,fabianfreyer/libvirt,zhlcindy/libvirt-1.1.4-maintain,datto/libvirt,bjzhang/libvirt,bjzhang/libvirt,VenkatDatta/libvirt,taget/libvirt,siboulet/libvirt-openvz,dumbbell/libvirt,novel/fbsd-libvirt,wiedi/libvirt,iam-TJ/libvirt,zhlcindy/libvirt-1.1.4-maintain,dumbbell/libvirt,rmarwaha/libvirt,VenkatDatta/libvirt,trainstack/libvirt,zippy2/libvirt,jfehlig/libvirt,bjzhang/libvirt,nertpinx/libvirt,olafhering/libvirt,cbosdo/libvirt,novel/fbsd-libvirt,jfehlig/libvirt,andreabolognani/libvirt,jardasgit/libvirt,libvirt/libvirt,shugaoye/libvirt,crobinso/libvirt,shugaoye/libvirt