$OpenBSD: patch-src_gtk_menu_cpp,v 1.1.1.1 2004/07/16 21:01:35 todd Exp $ --- src/gtk/menu.cpp.orig 2003-09-20 20:24:30.000000000 +1000 +++ src/gtk/menu.cpp 2003-10-04 13:24:11.000000000 +1000 @@ -371,7 +371,7 @@ bool wxMenuBar::GtkAppend(wxMenu *menu, /* local buffer in multibyte form */ char cbuf[400]; - strcpy(cbuf, wxGTK_CONV(buf) ); + strlcpy(cbuf, wxGTK_CONV(buf), sizeof(cbuf)); GtkItemFactoryEntry entry; entry.path = (gchar *)cbuf; // const_cast @@ -1150,8 +1150,8 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem /* local buffer in multibyte form */ char buf[200]; - strcpy( buf, "/" ); - strcat( buf, wxGTK_CONV( text ) ); + strlcpy( buf, "/", sizeof(buf)); + strlcat( buf, wxGTK_CONV( text ), sizeof(buf)); GtkItemFactoryEntry entry; entry.path = buf; @@ -1240,8 +1240,8 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem char bufPath[256], bufType[256]; - strcpy( bufPath, "/" ); - strncat( bufPath, wxGTK_CONV(text), WXSIZEOF(bufPath) - 2 ); + strlcpy( bufPath, "/", WXSIZEOF(bufPath)); + strlcat( bufPath, wxGTK_CONV(text), WXSIZEOF(bufPath)); bufPath[WXSIZEOF(bufPath) - 1] = '\0'; GtkItemFactoryEntry entry; @@ -1272,8 +1272,7 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem pathRadio.Replace(wxT("_"), wxT("")); pathRadio.Prepend(wxT("
/")); - strncpy(bufType, wxGTK_CONV(pathRadio), WXSIZEOF(bufType)); - bufType[WXSIZEOF(bufType) - 1] = '\0'; + strlcpy(bufType, wxGTK_CONV(pathRadio), WXSIZEOF(bufType)); item_type = bufType; } @@ -1357,7 +1356,7 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem // somehow! (VZ) char s_accel[50]; // should be big enough, we check for overruns wxString tmp( GetHotKey(*mitem) ); - strncpy(s_accel, wxGTK_CONV( tmp ), WXSIZEOF(s_accel)); + strlcpy(s_accel, wxGTK_CONV( tmp ), WXSIZEOF(s_accel)); s_accel[WXSIZEOF(s_accel) - 1] = '\0'; entry.accelerator = s_accel; #else // !wxUSE_ACCEL @@ -1946,4 +1945,3 @@ changed_have_pixmap_status (GtkPixmapMen } #endif // __WXGTK20__ -