mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-02 18:27:18 +00:00
* Fix 2 more bugs in OpenBSD file(1)
- ref: http://lolcathost.org/b/openbsd-file.patch
This commit is contained in:
parent
6afd85a447
commit
bf463cae9e
@ -257,6 +257,7 @@ apprentice_1(struct r_magic_set *ms, const char *fn, int action,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ms->file = fn; // fix use of ms->file before being initialized
|
||||||
if (action == FILE_COMPILE) {
|
if (action == FILE_COMPILE) {
|
||||||
rv = apprentice_load(ms, &magic, &nmagic, fn, action);
|
rv = apprentice_load(ms, &magic, &nmagic, fn, action);
|
||||||
if (rv != 0)
|
if (rv != 0)
|
||||||
|
@ -44,28 +44,12 @@ int
|
|||||||
file_printf(struct r_magic_set *ms, const char *fmt, ...)
|
file_printf(struct r_magic_set *ms, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
int len;
|
int ret;
|
||||||
char *buf, *newstr;
|
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
len = vasprintf(&buf, fmt, ap);
|
ret = file_vprintf (ms, fmt, ap);
|
||||||
if (len < 0)
|
|
||||||
goto out;
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
return ret;
|
||||||
if (ms->o.buf != NULL) {
|
|
||||||
len = asprintf(&newstr, "%s%s", ms->o.buf, buf);
|
|
||||||
free(buf);
|
|
||||||
if (len < 0)
|
|
||||||
goto out;
|
|
||||||
free(ms->o.buf);
|
|
||||||
buf = newstr;
|
|
||||||
}
|
|
||||||
ms->o.buf = buf;
|
|
||||||
return 0;
|
|
||||||
out:
|
|
||||||
file_error(ms, errno, "vasprintf failed");
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// copypasta to fix an OPENBSDBUG
|
// copypasta to fix an OPENBSDBUG
|
||||||
|
Loading…
Reference in New Issue
Block a user