eldbus: Check return value of _type_size

_type_size could return 0, which would fail in the modulo call next.
Check for 0, and return.

Fixes CID 1039436
This commit is contained in:
Sebastian Dransfeld 2013-12-07 14:10:44 +01:00
parent 63f824c659
commit 1d1feea572
2 changed files with 3 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -87,6 +87,8 @@ _type_offset(char type, unsigned base)
{
unsigned size, padding;
size = _type_size(type);
if (size == 0)
return base;
if (!(base % size))
return base;
padding = abs(base - size);