Browse Source

[settings] Fix erroneous bit-masking in fetch_uintz_setting()

tags/v0.9.8
Michael Brown 15 years ago
parent
commit
c5a88ed553
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      src/core/settings.c

+ 2
- 1
src/core/settings.c View File

544
 		return len;
544
 		return len;
545
 
545
 
546
 	/* Mask off sign-extended bits */
546
 	/* Mask off sign-extended bits */
547
-	*value = ( svalue & ( -1UL >> ( sizeof ( long ) - len ) ) );
547
+	assert ( len <= ( int ) sizeof ( long ) );
548
+	*value = ( svalue & ( -1UL >> ( 8 * ( sizeof ( long ) - len ) ) ) );
548
 
549
 
549
 	return len;
550
 	return len;
550
 }
551
 }

Loading…
Cancel
Save