[cli] Fix potential out-of-bounds memory access.
authorMatthias Bolte <matthias.bolte@googlemail.com>
Sat, 18 Apr 2009 18:02:49 +0000 (20:02 +0200)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Sat, 18 Apr 2009 18:02:49 +0000 (20:02 +0200)
Signed-off-by: Matthias Bolte <matthias.bolte@googlemail.com>

cli/help.c

index 0efb2ec..3de6a51 100644 (file)
@@ -176,8 +176,8 @@ _help (struct VscError *error,
 
                length = strlen (command_info_->name) + 10;
 
-               if (length > 256) {
-                       length = 256;
+               if (length > 255) {
+                       length = 255;
                }
 
                for (int i = 0; i < length; i++) {
@@ -200,8 +200,8 @@ _help (struct VscError *error,
                total = _limited_printf ("", 0, "       %s", command_info_->name);
                length = strlen (command_info_->name) + 7;
 
-               if (length > 256) {
-                       length = 256;
+               if (length > 255) {
+                       length = 255;
                }
 
                for (int i = 0; i < length; i++) {
@@ -273,8 +273,8 @@ _help (struct VscError *error,
 
                        length = strlen (_vsc_cli_name) + 10;
 
-                       if (length > 256) {
-                               length = 256;
+                       if (length > 255) {
+                               length = 255;
                        }
 
                        for (int i = 0; i < length; i++) {
@@ -309,8 +309,8 @@ _help (struct VscError *error,
 
                        length = strlen (_vsc_cli_name) + 7;
 
-                       if (length > 256) {
-                               length = 256;
+                       if (length > 255) {
+                               length = 255;
                        }
 
                        for (int i = 0; i < length; i++) {