$OpenBSD: patch-protocols_oscar_oscar_c,v 1.4 2007/01/14 21:53:01 simon Exp $ --- protocols/oscar/oscar.c.orig Sat Jun 24 17:00:44 2006 +++ protocols/oscar/oscar.c Fri Dec 15 21:20:08 2006 @@ -146,7 +146,7 @@ static char *extract_name(const char *na tmp[j++] = x[i]; continue; } - strncpy(hex, x + ++i, 2); hex[2] = 0; + strlcpy(hex, x + ++i, sizeof(hex)); i++; tmp[j++] = (char)strtol(hex, NULL, 16); } @@ -291,7 +291,7 @@ static void oscar_callback(gpointer data c->inpa = 0; c->fd = -1; aim_conn_kill(odata->sess, &conn); - sprintf(buf, _("You have been disconnected from chat room %s."), c->name); + g_snprintf(buf, sizeof(buf), _("You have been disconnected from chat room %s."), c->name); do_error_dialog(sess->aux_data, buf, _("Chat Error!")); } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { if (odata->cnpa > 0) @@ -1362,7 +1362,7 @@ static int gaim_parse_msgerr(aim_session destn = va_arg(ap, char *); va_end(ap); - sprintf(buf, _("Your message to %s did not get sent: %s"), destn, + g_snprintf(buf, sizeof(buf), _("Your message to %s did not get sent: %s"), destn, (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown")); do_error_dialog(sess->aux_data, buf, _("Gaim - Error")); @@ -1380,7 +1380,7 @@ static int gaim_parse_locerr(aim_session destn = va_arg(ap, char *); va_end(ap); - sprintf(buf, _("User information for %s unavailable: %s"), destn, + g_snprintf(buf, sizeof(buf), _("User information for %s unavailable: %s"), destn, (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown")); do_error_dialog(sess->aux_data, buf, _("Gaim - Error")); @@ -2383,7 +2383,7 @@ static char *oscar_encoding_to_utf8(char * that was specified. So we assume it's UTF-8 and hope for the best. */ if (*utf8 == 0) { - strncpy(utf8, text, textlen); + strlcpy(utf8, text, 8192); } return utf8;