X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/d3a1a808f65812c591ef0de3e61a94b13aa73160..b7a189f38294c745ae4ea6efb55891c8196e275b:/puttygen.c diff --git a/puttygen.c b/puttygen.c index 4e2098e2..add94319 100644 --- a/puttygen.c +++ b/puttygen.c @@ -22,6 +22,23 @@ static int requested_help; static char *cmdline_keyfile = NULL; +/* + * Print a modal (Really Bad) message box and perform a fatal exit. + */ +void modalfatalbox(char *fmt, ...) +{ + va_list ap; + char *stuff; + + va_start(ap, fmt); + stuff = dupvprintf(fmt, ap); + va_end(ap); + MessageBox(NULL, stuff, "PuTTYgen Fatal Error", + MB_SYSTEMMODAL | MB_ICONERROR | MB_OK); + sfree(stuff); + exit(1); +} + /* ---------------------------------------------------------------------- * Progress report code. This is really horrible :-) */ @@ -206,14 +223,6 @@ static int prompt_keyfile(HWND hwnd, char *dlgtitle, } /* - * This function is needed to link with the DES code. We need not - * have it do anything at all. - */ -void logevent(char *msg) -{ -} - -/* * Dialog-box function for the Licence box. */ static int CALLBACK LicenceProc(HWND hwnd, UINT msg, @@ -356,10 +365,8 @@ static void setupbigedit1(HWND hwnd, int id, int idstatic, struct RSAKey *key) dec1 = bignum_decimal(key->exponent); dec2 = bignum_decimal(key->modulus); - buffer = smalloc(strlen(dec1) + strlen(dec2) + - strlen(key->comment) + 30); - sprintf(buffer, "%d %s %s %s", - bignum_bitcount(key->modulus), dec1, dec2, key->comment); + buffer = dupprintf("%d %s %s %s", bignum_bitcount(key->modulus), + dec1, dec2, key->comment); SetDlgItemText(hwnd, id, buffer); SetDlgItemText(hwnd, idstatic, "&Public key for pasting into authorized_keys file:"); @@ -1146,12 +1153,13 @@ static int CALLBACK MainDlgProc(HWND hwnd, UINT msg, int ret; FILE *fp = fopen(filename, "r"); if (fp) { - char buffer[FILENAME_MAX + 80]; + char *buffer; fclose(fp); - sprintf(buffer, "Overwrite existing file\n%.*s?", - FILENAME_MAX, filename); + buffer = dupprintf("Overwrite existing file\n%s?", + filename); ret = MessageBox(hwnd, buffer, "PuTTYgen Warning", MB_YESNO | MB_ICONWARNING); + sfree(buffer); if (ret != IDYES) break; } @@ -1189,12 +1197,13 @@ static int CALLBACK MainDlgProc(HWND hwnd, UINT msg, int ret; FILE *fp = fopen(filename, "r"); if (fp) { - char buffer[FILENAME_MAX + 80]; + char *buffer; fclose(fp); - sprintf(buffer, "Overwrite existing file\n%.*s?", - FILENAME_MAX, filename); + buffer = dupprintf("Overwrite existing file\n%s?", + filename); ret = MessageBox(hwnd, buffer, "PuTTYgen Warning", MB_YESNO | MB_ICONWARNING); + sfree(buffer); if (ret != IDYES) break; }