瀏覽代碼

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

tags/v0.9.8
Michael Brown 15 年之前
父節點
當前提交
c5a88ed553
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2
    1
      src/core/settings.c

+ 2
- 1
src/core/settings.c 查看文件

@@ -544,7 +544,8 @@ int fetch_uint_setting ( struct settings *settings, struct setting *setting,
544 544
 		return len;
545 545
 
546 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 550
 	return len;
550 551
 }

Loading…
取消
儲存