|
From: Peter K. <pk...@us...> - 2002-06-17 13:48:02
|
The following file was modified in apps/bluetooth/experimental:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bt_if.c 1.48 1.49=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Corrected set_local_hostname() so it does not hang if unprintable
characters are passed in local_name.
The diff of the modified file(s):
--- bt_if.c 3 Jun 2002 15:31:22 -0000 1.48
+++ bt_if.c 17 Jun 2002 13:47:58 -0000 1.49
@@ -51,6 +51,7 @@
#include <termios.h>
#include <stdlib.h>
#include <string.h>
+#include <ctype.h>
#include <syslog.h>
#include <errno.h>
#include <stdarg.h>
@@ -1342,14 +1343,15 @@
=20
*buf =3D '\0';
=20
- if (*local_name)
+ if (local_name && *local_name)
{
while (*local_name && len < LOCAL_NAME_LENGTH)
{
- if (*local_name >=3D ' ' && *local_name <=3D 'z')
+ if (isprint(*local_name))
{
- buf[len++] =3D *local_name++;
+ buf[len++] =3D *local_name;
}
+ local_name++;
}
=20=20
if (len && add_host)
@@ -1375,13 +1377,13 @@
}
}
}
+
if (len && add_host)
{
strcat(buf, ")");
}
=20
bt_set_local_name(bt_cfd, buf);
-
}
=20
void bt_set_local_name(int bt_cfd, const unsigned char *name)
|