Module Name:    src
Committed By:   christos
Date:           Tue Aug  1 11:56:58 UTC 2017

Modified Files:
        src/sys/arch/hpcmips/stand/pbsdboot: main.c

Log Message:
PR/52445: David Binderman: Fix wcstombs error checking


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/hpcmips/stand/pbsdboot/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/hpcmips/stand/pbsdboot/main.c
diff -u src/sys/arch/hpcmips/stand/pbsdboot/main.c:1.62 src/sys/arch/hpcmips/stand/pbsdboot/main.c:1.63
--- src/sys/arch/hpcmips/stand/pbsdboot/main.c:1.62	Fri Dec 14 16:15:52 2007
+++ src/sys/arch/hpcmips/stand/pbsdboot/main.c	Tue Aug  1 07:56:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.62 2007/12/14 21:15:52 pavel Exp $	*/
+/*	$NetBSD: main.c,v 1.63 2017/08/01 11:56:58 christos Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000 Shin Takemura.
@@ -1114,13 +1114,11 @@ BOOL BootKernel(int directboot)
 			szAppName, MB_OK);
 		return FALSE;
 	}				
-	GetDlgItemText(hDlgMain, IDC_OPTIONS,
-		woptions, sizeof(woptions));
-	if (wcstombs(options, woptions, sizeof(options)) < 0 ||
-		wcstombs(kernel_name, wkernel_name,
-			     sizeof(kernel_name)) < 0) {
-		MessageBox (NULL, TEXT("invalid character"),
-			szAppName, MB_OK);
+	GetDlgItemText(hDlgMain, IDC_OPTIONS, woptions, sizeof(woptions));
+	if (wcstombs(options, woptions, sizeof(options)) == (size_t)-1 ||
+	    wcstombs(kernel_name, wkernel_name, sizeof(kernel_name))
+	    == (size_t)-1) {
+		MessageBox(NULL, TEXT("invalid character"), szAppName, MB_OK);
 		return FALSE;
 	}
 	
@@ -1209,8 +1207,8 @@ BOOL BootKernel(int directboot)
 		platid.dw.dw0 = bi.platid_cpu;
 		platid.dw.dw1 = bi.platid_machine;
 		if (set_system_info(&platid)) {
-		/*
-		*  boot !
+			/*
+			*  boot !
 			*/
 			pbsdboot(wkernel_name, argc, argv, &bi);
 		}

Reply via email to