const char* secType = secTypeName(getCurrentCSecurity()->getType());
const char* titlePrefix = "VNC Authentication";
- CharArray title(strlen(titlePrefix) + strlen(secType) + 4);
- sprintf(title.buf, "%s [%s]", titlePrefix, secType);
+ unsigned int titleLen = strlen(titlePrefix) + strlen(secType) + 4;
+ CharArray title(titleLen);
+ snprintf(title.buf, titleLen, "%s [%s]", titlePrefix, secType);
PasswdDialog dlg(dpy, title.buf, !user);
if (!dlg.show()) return false;
if (user)
menu.addEntry("Ctrl", ID_CTRL);
menu.addEntry("Alt", ID_ALT);
CharArray menuKeyStr(menuKey.getData());
- CharArray sendMenuKey(6+strlen(menuKeyStr.buf));
- sprintf(sendMenuKey.buf, "Send %s", menuKeyStr.buf);
+ unsigned int sendMenuKeyLen = 6+strlen(menuKeyStr.buf);
+ CharArray sendMenuKey(sendMenuKeyLen);
+ snprintf(sendMenuKey.buf, sendMenuKeyLen, "Send %s", menuKeyStr.buf);
menu.addEntry(sendMenuKey.buf, ID_F8);
menu.addEntry("Send Ctrl-Alt-Del", ID_CTRLALTDEL);
menu.addEntry(0, 0);
serverPF.print(spfStr, 100);
int secType = getCurrentCSecurity()->getType();
char infoText[1024];
- sprintf(infoText,
+ snprintf(infoText, sizeof(infoText),
"Desktop name: %.80s\n"
"Host: %.80s port: %d\n"
"Size: %d x %d\n"
CharArray windowNameStr(windowName.getData());
if (!windowNameStr.buf[0]) {
windowNameStr.replaceBuf(new char[256]);
- sprintf(windowNameStr.buf,"VNC: %.240s",cp.name());
+ snprintf(windowNameStr.buf, 256, "VNC: %.240s", cp.name());
}
viewport->toplevel(windowNameStr.buf, this, argc, argv);
viewport->setBumpScroll(fullScreen);
"0 = Low, 9 = High",
6);
-char aboutText[256];
+char aboutText[1024];
char* programName;
extern char buildtime[];
int main(int argc, char** argv)
{
- sprintf(aboutText, "TightVNC viewer for X version 4.0 - built %s\n"
- "Copyright (C) 2002-2004 RealVNC Ltd.\n"
- "Copyright (C) 2000-2004 Constantin Kaplinsky.\n"
- "Copyright (C) 2004 Peter Astrand, Cendio AB\n"
- "See http://www.tightvnc.com for information on TightVNC.",
- buildtime);
+ snprintf(aboutText, sizeof(aboutText),
+ "TightVNC viewer for X version 4.0 - built %s\n"
+ "Copyright (C) 2002-2004 RealVNC Ltd.\n"
+ "Copyright (C) 2000-2004 Constantin Kaplinsky.\n"
+ "Copyright (C) 2004 Peter Astrand, Cendio AB\n"
+ "See http://www.tightvnc.com for information on TightVNC.",
+ buildtime);
fprintf(stderr,"\n%s\n", aboutText);
rfb::initStdIOLoggers();