[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] number conversion in lvm



Hi

I found some strange code in _get_int_arg in ./tools/lvmcmdline.c:

v = strtol(val, ptr, 10);

if (*ptr == val)
        return 0;

av->i_value = (int32_t) v;
av->ui_value = (uint32_t) v;
av->i64_value = (int64_t) v;
av->ui64_value = (uint64_t) v;

It is taking 32-bit long value and then casting it to 64 bits. Should 
there be strtoull instead of strtol?

BTW. how is that function supposed to handle integer overflow - it doesn't 
seem to do that.

Mikulas


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]