**Describe the bug**
The following code checks that `strtol` doesn't read a negative number from the environment variable.
<img width="1155" alt="image" src="https://github.com/Blosc/c-blosc2/assets/43664/c7b0c7e6-135c-4658-9b26-933fe8f50fa8">
What the code should really do is check that `((int16_t) nthreads) > 0`. That is, `strtol` could read in `65535`, which is a non-negative `long` number. Then, the (highlighted) cast to an `int16_t` would interpret this as `-1`.

**To Reproduce**
Set `BLOSC_NTHREADS` environment variable to `65535`.

**System information:**
 - OS: macOS
 - Compiler: Clang
 - Version: 16
Signed down cast negates usefulness of preceding bounds check
This is a GitHub Issue
repo:c-blosc2
owner:Blosc
Title : Signed down cast negates usefulness of preceding bounds check
Issue date:

--- start body ---
**Describe the bug**
The following code checks that `strtol` doesn't read a negative number from the environment variable.
<img width="1155" alt="image" src="https://github.com/Blosc/c-blosc2/assets/43664/c7b0c7e6-135c-4658-9b26-933fe8f50fa8">
What the code should really do is check that `((int16_t) nthreads) > 0`. That is, `strtol` could read in `65535`, which is a non-negative `long` number. Then, the (highlighted) cast to an `int16_t` would interpret this as `-1`.

**To Reproduce**
Set `BLOSC_NTHREADS` environment variable to `65535`.

**System information:**
 - OS: macOS
 - Compiler: Clang
 - Version: 16
--- end body ---

The issue describes a potential vulnerability where the code checks if the value read from an environment variable is non-negative, but then casts it to a signed 16-bit integer (int16_t). This can lead to an integer overflow if the value is greater than 32767, resulting in a negative value. This could allow for unexpected behavior or exploitation if the value is used in subsequent calculations or logic that assumes it is non-negative.