Skip to content
  • Jan Kneschke's avatar
    30ce5e45
    Bug#32297657 --conf-base-port accepts hex and oct values · 30ce5e45
    Jan Kneschke authored
    Problem
    =======
    
    --conf-base-port and several other integer command-line
    and config-file options accept hex and octal notation like:
    
      --conf-base-port=0xff  // hex
      --conf-base-port=077   // octal
    
    which in case of octal notation error prone and unintended.
    
    They also don't report errors in case the values isn't completely
    numeric like '1zzz'.
    
    Root-cause is the use of:
    
    - strtol(..., ..., 0);      // enable base detection
    - strtol(..., nullptr, 10); // ignoring invalid input
    - stol(...);                // ignoring invalid input
    
    Affects at least:
    
    * --conf-base-port
    * routing.router_id
    * routing.thread_stack_size
    * metadata_cache.read_timeout
    * metadata_cache.connect_timeout
    * metadata_cache.use_gr_notifications
    * http_server.http_port
    * http_server.port
    * http_server.xport
    * http_server.ssl
    * io.threads
    
    Change
    ======
    
    - report error if string isn't completely numeric
    - report error if string is hex or octal.
    - added tests for hex input
    
    RB: 25672
    30ce5e45
    Bug#32297657 --conf-base-port accepts hex and oct values
    Jan Kneschke authored
    Problem
    =======
    
    --conf-base-port and several other integer command-line
    and config-file options accept hex and octal notation like:
    
      --conf-base-port=0xff  // hex
      --conf-base-port=077   // octal
    
    which in case of octal notation error prone and unintended.
    
    They also don't report errors in case the values isn't completely
    numeric like '1zzz'.
    
    Root-cause is the use of:
    
    - strtol(..., ..., 0);      // enable base detection
    - strtol(..., nullptr, 10); // ignoring invalid input
    - stol(...);                // ignoring invalid input
    
    Affects at least:
    
    * --conf-base-port
    * routing.router_id
    * routing.thread_stack_size
    * metadata_cache.read_timeout
    * metadata_cache.connect_timeout
    * metadata_cache.use_gr_notifications
    * http_server.http_port
    * http_server.port
    * http_server.xport
    * http_server.ssl
    * io.threads
    
    Change
    ======
    
    - report error if string isn't completely numeric
    - report error if string is hex or octal.
    - added tests for hex input
    
    RB: 25672
Loading