Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/hpcmips/stand/pbsdboot PR/52445: David Binderman: F...



details:   https://anonhg.NetBSD.org/src/rev/1e3ae4e9ab49
branches:  trunk
changeset: 825820:1e3ae4e9ab49
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Aug 01 11:56:58 2017 +0000

description:
PR/52445: David Binderman: Fix wcstombs error checking

diffstat:

 sys/arch/hpcmips/stand/pbsdboot/main.c |  18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diffs (39 lines):

diff -r e3aa65906a65 -r 1e3ae4e9ab49 sys/arch/hpcmips/stand/pbsdboot/main.c
--- a/sys/arch/hpcmips/stand/pbsdboot/main.c    Tue Aug 01 11:12:49 2017 +0000
+++ b/sys/arch/hpcmips/stand/pbsdboot/main.c    Tue Aug 01 11:56:58 2017 +0000
@@ -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 @@
                        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 @@
                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);
                }



Home | Main Index | Thread Index | Old Index