mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-30 16:10:44 +08:00
Force attribute value to be in-range vs causing error.
re: https://github.com/conda-forge/libnetcdf-feedstock/pull/26 (Note: note conda-forge, not Unidata). Revert dap2 code to 4.4.1.1. behavior so that attribute values are forced into a specific range. Current behavior generates error if an attribute value is out of range.
This commit is contained in:
parent
a2964f5fb0
commit
338f958e46
@ -217,7 +217,8 @@ dapcvtattrval(nc_type etype, void* dst, NClist* src)
|
||||
#ifdef _MSC_VER
|
||||
_ASSERTE(_CrtCheckMemory());
|
||||
#endif
|
||||
if(ival < 0 || ival > NC_MAX_UBYTE) ok = 0;
|
||||
/* For back compatibility, we allow any value, but force conversion */
|
||||
ival = (ival & 0xFF);
|
||||
*p = (char)ival;
|
||||
} break;
|
||||
case NC_CHAR: {
|
||||
@ -246,7 +247,8 @@ dapcvtattrval(nc_type etype, void* dst, NClist* src)
|
||||
unsigned int uval;
|
||||
ok = sscanf(s,"%u%n",&uval,&nread);
|
||||
_ASSERTE(_CrtCheckMemory());
|
||||
if(uval > NC_MAX_UBYTE) ok = 0;
|
||||
/* For back compatibility, we allow any value, but force conversion */
|
||||
uval = (uval & 0xFF);
|
||||
*p = (unsigned char)uval;
|
||||
#else
|
||||
ok = sscanf(s,"%hhu%n",p,&nread);
|
||||
|
Loading…
Reference in New Issue
Block a user