[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

talkd malloc check



doesnt chack if malloc fails in announce.c

-pete

--- libexec/talkd/announce.c.old	Tue Sep 24 07:39:19 2002
+++ libexec/talkd/announce.c	Tue Sep 24 07:41:35 2002
@@ -127,6 +127,10 @@
 	max_size = max(max_size, sizes[i]);
 	i++;
 	vis_user = (char *) malloc(strlen(request->l_name) * 4 + 1);
+	if (vis_user == NULL) {
+		syslog(LOG_ERR, "%m");
+		_exit(1);
+	} 
 	strvis(vis_user, request->l_name, VIS_CSTYLE);
 	(void)snprintf(line_buf[i], N_CHARS,
 	    "talk: connection requested by %s_(_at_)_%s_(_dot_)_",



Visit your host, monkey.org