antirez / antirez/sds

Null Dereferences v2.0.0

Đang mở
#99 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C
Star
5.6k
Fork
510
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

In many functions in file “sds.h”, the parameter “sds s” is dereferenced without checking if it is NULL. The same error is also present in some functions in file “sds.c”, such as: `sdscat`, `sdsMakeRoomFor`, `sdsRemoveFreeSpace`, `sdsdup`, `sdsupdatelen`, `sdscatrepr`, `sdscmp`, `sdstoupper`, `sdstolower`, `sdsrange`, `sdstrim`, `sdscatfmt`, `sdsclear`, `sdslen`, `sdscatvprintf`, `sdscatprintf`, `sdscpy`, `sdscpylen`, `sdscatsds`, `sdscatlen`, `sdsgrowzero`, `sdsIncrLen`, `sdsAllocSize` e `sdsAllocPtr`.

This functions should check for a parameter with value NULL and possibly return an error code in such case.

Minimal example:

```C
int sdsTest(void) {
sds x = NULL;
test_cond("Create a string and obtain the length",
sdslen(x) == 3 && memcmp(x,"foo\0",4) == 0)

sdsfree(x);
test_report();
return 0;
}
```

Forcing the variable “sds s = NULL” while running the test programs generates a segmentation fault (due to the attempt to dereference NULL).

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.