• Dmitry Safonov's avatar
    criu-util: do not double free and simplify xvstrcat · 8f95747e
    Dmitry Safonov authored
    There is a bug, that if vsnprintf() wrote nothing to buffer:
    that may be xstrcat(0, "%s", "") or something like that,
    than vsnprintf's return value is 0, which will be lesser than
    delta. The code before would do following:
    o first cycle:
      1. relocate str to new (str is not allocated anymore)
      2. vsnprintf() retured 0, delta is greater.
    o second cycle:
      1. relocate previously freed str to new..^C ^C
    Segmentation fault (core dumped)
    
    Weeell, I do think, we can do better job here.
    Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
    Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
    8f95747e
Name
Last commit
Last update
Documentation Loading commit data...
contrib Loading commit data...
coredump Loading commit data...
crit Loading commit data...
criu Loading commit data...
images Loading commit data...
lib Loading commit data...
scripts Loading commit data...
test Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
.travis.yml Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
INSTALL.md Loading commit data...
Makefile Loading commit data...
Makefile.install Loading commit data...
Makefile.versions Loading commit data...
README.md Loading commit data...