mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 12:23:32 +01:00
Detect tor_addr_to_str failure in tor_dup_addr.
This avoids a possible strdup of an uninitialized buffer. Fixes 4529; fix on 0.2.1.3-alpha; reported by troll_un.
This commit is contained in:
parent
fbf1c5ee79
commit
3ebe960f3f
5
changes/bug4529
Normal file
5
changes/bug4529
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
o Minor bufixes:
|
||||||
|
- If we had ever tried to call tor_addr_to_str on an address of
|
||||||
|
unknown type, we would have done a strdup on an uninitialized
|
||||||
|
buffer. Now we won't. Fixes bug 4529; bugfix on 0.2.1.3-alpha.
|
||||||
|
Reported by "troll_un".
|
@ -945,8 +945,11 @@ char *
|
|||||||
tor_dup_addr(const tor_addr_t *addr)
|
tor_dup_addr(const tor_addr_t *addr)
|
||||||
{
|
{
|
||||||
char buf[TOR_ADDR_BUF_LEN];
|
char buf[TOR_ADDR_BUF_LEN];
|
||||||
tor_addr_to_str(buf, addr, sizeof(buf), 0);
|
if (tor_addr_to_str(buf, addr, sizeof(buf), 0)) {
|
||||||
return tor_strdup(buf);
|
return tor_strdup(buf);
|
||||||
|
} else {
|
||||||
|
return tor_strdup("<unknown address type>");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return a string representing the address <b>addr</b>. This string is
|
/** Return a string representing the address <b>addr</b>. This string is
|
||||||
|
Loading…
Reference in New Issue
Block a user