Add SPP coverity fixes (#6416)

This commit is contained in:
Sven Steinbauer 2017-01-03 11:47:27 +00:00 committed by radare
parent e18ced61af
commit f73fc431ae
2 changed files with 6 additions and 20 deletions

View File

@ -74,9 +74,11 @@ TAG_CALLBACK(spp_getrandom)
if (!echo[ifl]) {
return 0;
}
srandom (getpid()); // TODO: change this to be portable
srandom (getpid ()); // TODO: change this to be portable
max = atoi (buf);
max = (int)(rand()%max);
if (max > 0) {
max = (int)(rand () % max);
}
do_printf (out, "%d", max);
return 0;
}
@ -363,6 +365,7 @@ TAG_CALLBACK(spp_endpipe)
pclose (spp_pipe_fd);
}
spp_pipe_fd = NULL;
free (str);
return 0;
}

View File

@ -224,24 +224,7 @@ retry:
do_fputs (out, ptr2 + delta);
} else {
D printf ("==> 3\n");
if (ptr) {
lbuf_strcat (lbuf, ptr);
} else {
if (!lbuf) {
// XXX should never happen
fprintf (stderr, "syntax error?\n");
return;
}
if (buf[0]) {
if (incmd) {
lbuf_strcat (lbuf, buf);
} else {
do_fputs (out, buf);
}
} else {
do_fputs (out, buf);
}
}
lbuf_strcat (lbuf, ptr);
}
}