wok-6.x diff util-linux/stuff/util-linux-ng-cfdisk.patch @ rev 12965

Up: slitaz-base-files (5.2.3)
author Christophe Lincoln <pankso@slitaz.org>
date Fri Jun 01 08:32:45 2012 +0200 (2012-06-01)
parents cb53e0d30346
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/util-linux/stuff/util-linux-ng-cfdisk.patch	Fri Jun 01 08:32:45 2012 +0200
     1.3 @@ -0,0 +1,57 @@
     1.4 +From 54a0fe298b4d6d948cffbd6fbbbe7dbabc9a6bb1 Mon Sep 17 00:00:00 2001
     1.5 +From: Karel Zak <kzak@redhat.com>
     1.6 +Date: Mon, 19 Jul 2010 22:52:58 +0200
     1.7 +Subject: [PATCH] cfdisk: get_string not calculating correct limits
     1.8 +
     1.9 +Reported-by: James L. Hammons <jlhamm@acm.org>
    1.10 +Signed-off-by: Karel Zak <kzak@redhat.com>
    1.11 +---
    1.12 + fdisk/cfdisk.c |   11 ++++++++---
    1.13 + 1 files changed, 8 insertions(+), 3 deletions(-)
    1.14 +
    1.15 +diff --git a/fdisk/cfdisk.c b/fdisk/cfdisk.c
    1.16 +index 7fa0b19..e7955fe 100644
    1.17 +--- a/fdisk/cfdisk.c
    1.18 ++++ b/fdisk/cfdisk.c
    1.19 +@@ -421,6 +421,11 @@ fdexit(int ret) {
    1.20 +     exit(ret);
    1.21 + }
    1.22 + 
    1.23 ++/*
    1.24 ++ * Note that @len is size of @str buffer.
    1.25 ++ *
    1.26 ++ * Returns number of read bytes (without \0).
    1.27 ++ */
    1.28 + static int
    1.29 + get_string(char *str, int len, char *def) {
    1.30 +     size_t cells = 0, i = 0;
    1.31 +@@ -472,7 +477,7 @@ get_string(char *str, int len, char *def) {
    1.32 + 	    break;
    1.33 + 	default:
    1.34 + #if defined(HAVE_LIBNCURSESW) && defined(HAVE_WIDECHAR)
    1.35 +-	    if (i < len && iswprint(c)) {
    1.36 ++	    if (i + 1 < len && iswprint(c)) {
    1.37 + 		wchar_t wc = (wchar_t) c;
    1.38 + 		char s[MB_CUR_MAX + 1];
    1.39 + 		int  sz = wctomb(s, wc);
    1.40 +@@ -492,7 +497,7 @@ get_string(char *str, int len, char *def) {
    1.41 + 			putchar(BELL);
    1.42 + 	    }
    1.43 + #else
    1.44 +-	    if (i < len && isprint(c)) {
    1.45 ++	    if (i + 1 < len && isprint(c)) {
    1.46 + 	        mvaddch(y, x + cells, c);
    1.47 + 		if (use_def) {
    1.48 + 		    clrtoeol();
    1.49 +@@ -2405,7 +2410,7 @@ change_id(int i) {
    1.50 + 
    1.51 +     sprintf(def, "%02X", new_id);
    1.52 +     mvaddstr(COMMAND_LINE_Y, COMMAND_LINE_X, _("Enter filesystem type: "));
    1.53 +-    if ((len = get_string(id, 2, def)) <= 0 && len != GS_DEFAULT)
    1.54 ++    if ((len = get_string(id, 3, def)) <= 0 && len != GS_DEFAULT)
    1.55 + 	return;
    1.56 + 
    1.57 +     if (len != GS_DEFAULT) {
    1.58 +-- 
    1.59 +1.7.2.1
    1.60 +