Project

General

Profile

Bug #20

Integer ptype does not filter for overflows

Added by Anonymous over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
Start date:
04/06/2016
Due date:
% Done:

0%


Description

If we have a ptype like the one below:

   <PTYPE help="0-10"                                                                                            
          method="integer"                                                                                         
          name="RANGE"                                                                                      
          pattern="0..10" />                                                                                     

And we have a command use RANGE as an input PARAM:


> testrange ?
> 0-10   Help text for range

If we enter something like this:

> testrange -1111111111111111111111111111
>

It is accepted (as under the covers atoi() is used and returns 0 when it doesn't understand the given input.

Both CLISH_PTYPE_UNSIGNEDINTEGER and CLISH_PTYPE_INTEGER are affected.

I have attached a patch that instead uses strtol().

klish-ptype.diff Magnifier (1.66 KB) Anonymous, 04/07/2016 12:58 AM

History

#1 Updated by Serj Kalichev over 2 years ago

  • Status changed from New to Resolved

#2 Updated by Serj Kalichev over 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF