Merge pull request #454 from nfi/contrib/uiplib-unspec-addr
uiplib: ensure output string is null-terminated when printing the unspecified address
This commit is contained in:
commit
4151461289
@ -250,9 +250,11 @@ uiplib_ipaddr_snprint(char *buf, size_t size, const uip_ipaddr_t *addr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(n >= size - 1) {
|
/*
|
||||||
buf[size - 1] = '\0';
|
* Make sure the output string is always null-terminated.
|
||||||
}
|
*/
|
||||||
|
buf[MIN(n, size - 1)] = '\0';
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
Loading…
Reference in New Issue
Block a user