|
|
6bbd11 |
autofs-5.1.0 - fix buffer size checks in get_network_proximity()
|
|
|
6bbd11 |
|
|
|
6bbd11 |
From: Ian Kent <raven@themaw.net>
|
|
|
6bbd11 |
|
|
|
6bbd11 |
Add several buffer size checks in get_network_proximity().
|
|
|
6bbd11 |
---
|
|
|
6bbd11 |
CHANGELOG | 1 +
|
|
|
6bbd11 |
lib/parse_subs.c | 8 +++++---
|
|
|
6bbd11 |
2 files changed, 6 insertions(+), 3 deletions(-)
|
|
|
6bbd11 |
|
|
|
6bbd11 |
--- autofs-5.0.7.orig/CHANGELOG
|
|
|
6bbd11 |
+++ autofs-5.0.7/CHANGELOG
|
|
|
6bbd11 |
@@ -135,6 +135,7 @@
|
|
|
6bbd11 |
- fix FILE pointer check in defaults_read_config().
|
|
|
6bbd11 |
- fix memory leak in conf_amd_get_log_options().
|
|
|
6bbd11 |
- fix signed comparison in inet_fill_net().
|
|
|
6bbd11 |
+- fix buffer size checks in get_network_proximity().
|
|
|
6bbd11 |
|
|
|
6bbd11 |
25/07/2012 autofs-5.0.7
|
|
|
6bbd11 |
=======================
|
|
|
6bbd11 |
--- autofs-5.0.7.orig/lib/parse_subs.c
|
|
|
6bbd11 |
+++ autofs-5.0.7/lib/parse_subs.c
|
|
|
6bbd11 |
@@ -437,7 +437,7 @@ unsigned int get_network_proximity(const
|
|
|
6bbd11 |
{
|
|
|
6bbd11 |
struct addrinfo hints;
|
|
|
6bbd11 |
struct addrinfo *ni, *this;
|
|
|
6bbd11 |
- char name_or_num[NI_MAXHOST];
|
|
|
6bbd11 |
+ char name_or_num[NI_MAXHOST + 1];
|
|
|
6bbd11 |
unsigned int proximity;
|
|
|
6bbd11 |
char *net;
|
|
|
6bbd11 |
int ret;
|
|
|
6bbd11 |
@@ -449,16 +449,18 @@ unsigned int get_network_proximity(const
|
|
|
6bbd11 |
if (net)
|
|
|
6bbd11 |
strcpy(name_or_num, net);
|
|
|
6bbd11 |
else {
|
|
|
6bbd11 |
- char this[NI_MAXHOST];
|
|
|
6bbd11 |
+ char this[NI_MAXHOST + 1];
|
|
|
6bbd11 |
char *mask;
|
|
|
6bbd11 |
|
|
|
6bbd11 |
+ if (strlen(name) > NI_MAXHOST)
|
|
|
6bbd11 |
+ return PROXIMITY_ERROR;
|
|
|
6bbd11 |
strcpy(this, name);
|
|
|
6bbd11 |
if ((mask = strchr(this, '/')))
|
|
|
6bbd11 |
*mask++ = '\0';
|
|
|
6bbd11 |
if (!strchr(this, '.'))
|
|
|
6bbd11 |
strcpy(name_or_num, this);
|
|
|
6bbd11 |
else {
|
|
|
6bbd11 |
- char buf[NI_MAXHOST], *new;
|
|
|
6bbd11 |
+ char buf[NI_MAXHOST + 1], *new;
|
|
|
6bbd11 |
new = inet_fill_net(this, buf);
|
|
|
6bbd11 |
if (!new)
|
|
|
6bbd11 |
return PROXIMITY_ERROR;
|