2005-12-07 Robert Love <rml@novell.com>

* src/NetworkManagerDevice.c: strncpy() buffer check.
	* src/NetworkManagerUtils.c: be anal about syslog() formatting.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1141 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Robert Love
2005-12-07 15:56:47 +00:00
committed by Robert Love
parent 09918c0a36
commit a4cab32122
3 changed files with 14 additions and 9 deletions

View File

@@ -1,3 +1,8 @@
2005-12-07 Robert Love <rml@novell.com>
* src/NetworkManagerDevice.c: strncpy() buffer check.
* src/NetworkManagerUtils.c: be anal about syslog() formatting.
2005-12-06 Dan Williams <dcbw@redhat.com> 2005-12-06 Dan Williams <dcbw@redhat.com>
* gnome/applet/applet-dbus.c * gnome/applet/applet-dbus.c

View File

@@ -1675,9 +1675,9 @@ void nm_device_update_ip4_address (NMDevice *dev)
if ((sk = nm_dev_sock_open (dev, DEV_GENERAL, __FUNCTION__, NULL)) == NULL) if ((sk = nm_dev_sock_open (dev, DEV_GENERAL, __FUNCTION__, NULL)) == NULL)
return; return;
memset (&req, 0, sizeof (struct ifreq)); memset (&req, 0, sizeof (struct ifreq));
strncpy ((char *)(&req.ifr_name), nm_device_get_iface (dev), strlen (nm_device_get_iface (dev))); strncpy (req.ifr_name, nm_device_get_iface (dev), sizeof (req.ifr_name) - 1);
#ifdef IOCTL_DEBUG #ifdef IOCTL_DEBUG
nm_info ("%s: About to GET IFADDR.", nm_device_get_iface (dev)); nm_info ("%s: About to GET IFADDR.", nm_device_get_iface (dev));
#endif #endif
@@ -1742,9 +1742,9 @@ void nm_device_update_hw_address (NMDevice *dev)
if ((sk = nm_dev_sock_open (dev, DEV_GENERAL, __FUNCTION__, NULL)) == NULL) if ((sk = nm_dev_sock_open (dev, DEV_GENERAL, __FUNCTION__, NULL)) == NULL)
return; return;
memset (&req, 0, sizeof (struct ifreq)); memset (&req, 0, sizeof (struct ifreq));
strncpy ((char *)(&req.ifr_name), nm_device_get_iface (dev), strlen (nm_device_get_iface (dev))); strncpy (req.ifr_name, nm_device_get_iface (dev), sizeof (req.ifr_name) - 1);
#ifdef IOCTL_DEBUG #ifdef IOCTL_DEBUG
nm_info ("%s: About to GET IFHWADDR.", nm_device_get_iface (dev)); nm_info ("%s: About to GET IFHWADDR.", nm_device_get_iface (dev));
#endif #endif
@@ -1806,7 +1806,7 @@ gboolean nm_device_is_up (NMDevice *dev)
return (FALSE); return (FALSE);
/* Get device's flags */ /* Get device's flags */
strcpy (ifr.ifr_name, nm_device_get_iface (dev)); strncpy (ifr.ifr_name, nm_device_get_iface (dev), sizeof (ifr.ifr_name) - 1);
#ifdef IOCTL_DEBUG #ifdef IOCTL_DEBUG
nm_info ("%s: About to GET IFFLAGS.", nm_device_get_iface (dev)); nm_info ("%s: About to GET IFFLAGS.", nm_device_get_iface (dev));
#endif #endif
@@ -4304,7 +4304,7 @@ static gboolean supports_ethtool_carrier_detect (NMDevice *dev)
return (FALSE); return (FALSE);
} }
strncpy (ifr.ifr_name, nm_device_get_iface (dev), sizeof(ifr.ifr_name)-1); strncpy (ifr.ifr_name, nm_device_get_iface (dev), sizeof(ifr.ifr_name) - 1);
edata.cmd = ETHTOOL_GLINK; edata.cmd = ETHTOOL_GLINK;
ifr.ifr_data = (char *) &edata; ifr.ifr_data = (char *) &edata;
#ifdef IOCTL_DEBUG #ifdef IOCTL_DEBUG
@@ -4369,7 +4369,7 @@ static gboolean supports_mii_carrier_detect (NMDevice *dev)
return (FALSE); return (FALSE);
} }
strncpy (ifr.ifr_name, nm_device_get_iface (dev), sizeof(ifr.ifr_name)-1); strncpy (ifr.ifr_name, nm_device_get_iface (dev), sizeof (ifr.ifr_name) - 1);
#ifdef IOCTL_DEBUG #ifdef IOCTL_DEBUG
nm_info ("%s: About to GET MIIPHY\n", nm_device_get_iface (dev)); nm_info ("%s: About to GET MIIPHY\n", nm_device_get_iface (dev));
#endif #endif

View File

@@ -621,7 +621,7 @@ gboolean nm_completion_boolean_function1_test(int tries,
if (message) if (message)
if ((log_interval == 0 && tries == 0) if ((log_interval == 0 && tries == 0)
|| (log_interval != 0 && tries % log_interval == 0)) || (log_interval != 0 && tries % log_interval == 0))
syslog(log_level, message); syslog(log_level, "%s", message);
if (!(*condition)(arg0)) if (!(*condition)(arg0))
return TRUE; return TRUE;
@@ -645,7 +645,7 @@ gboolean nm_completion_boolean_function2_test(int tries,
if (message) if (message)
if ((log_interval == 0 && tries == 0) if ((log_interval == 0 && tries == 0)
|| (log_interval != 0 && tries % log_interval == 0)) || (log_interval != 0 && tries % log_interval == 0))
syslog(log_level, message); syslog(log_level, "%s", message);
if (!(*condition)(arg0, arg1)) if (!(*condition)(arg0, arg1))
return TRUE; return TRUE;