--- ppp-2.4.4/pppd/plugins/radius/clientid.c.orig	2007-09-29 16:38:20 +0400
+++ ppp-2.4.4/pppd/plugins/radius/clientid.c	2007-11-27 09:08:24 +0300
@@ -104,18 +104,29 @@
 UINT4 rc_map2id(char *name)
 {
 	struct map2id_s *p;
-	char ttyname[PATH_MAX];
+	char *ttyname;
+	int ttyname_len=0;
+	char prefix_dev[6];
 
-	*ttyname = '\0';
-	if (*name != '/')
-		strcpy(ttyname, "/dev/");
-
-	strncat(ttyname, name, sizeof(ttyname));
+	*prefix_dev = "";
+	ttyname_len = strlen(name)+1;
+	
+	if (*name != '/') {
+		*prefix_dev = "/dev/";
+		ttyname_len = ttyname_len+strlen(prefix_dev);
+			}
+	
+	ttyname = calloc(ttyname_len, sizeof(char));
+	snprintf(ttyname, ttyname_len, "%s%s", prefix_dev, name);
 
 	for(p = map2id_list; p; p = p->next)
-		if (!strcmp(ttyname, p->name)) return p->id;
+		if (!strcmp(ttyname, p->name)) {
+			free(ttyname);
+			return p->id;
+				}
 
 	warn("rc_map2id: can't find tty %s in map database", ttyname);
 
+	free(ttyname);
 	return 0;
 }
