Make prefix_rd2str return an "Unknown" string when something
goes wrong. This will allow for simplification of the
code that uses prefix_rd2str.
Additionally ensure that size is big enough with an assert.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
struct rd_as rd_as;
struct rd_ip rd_ip;
- if (size < RD_ADDRSTRLEN)
- return NULL;
+ assert(size >= RD_ADDRSTRLEN);
pnt = prd->val;
return buf;
}
#endif
- return NULL;
+
+ snprintf(buf, size, "Unknown Type: %d", type);
+ return buf;
}