Bug 117183
| Summary: | strlen() on random pointer | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | d.binderman | ||||
| Component: | system-config-securitylevel | Assignee: | Brent Fox <bfox> | ||||
| Status: | CLOSED RAWHIDE | QA Contact: | |||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | high | ||||||
| Version: | rawhide | CC: | robert, tim.liim | ||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | All | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2004-03-05 15:27:02 UTC | Type: | --- | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
> ret = calloc((orig ? strlen(orig) : 0) + strlen(ret) + 2, sizeof(char)); > Doing strlen() on uninit memory is deeply unwise. You're right. > I'm not sure what the fix is for this. It's just a mistake ... Brent, please, change the strlen(ret) to the strlen(tmp) on line 254 in the lokkit.c file. Created attachment 98182 [details]
strlen() patch
Very simple patch fixing this bug.
Should be fixed in system-config-securitylevel-1.3.4-1. Thanks for the patch. *** Bug 122069 has been marked as a duplicate of this bug. *** |
Description of problem: I just tried to compile Core2 Test1 package system-config-securitylevel-1.3.1-1 The compiler said 1. lokkit.c(254): remark #592: variable "ret" is used before its value is set The source code is char *ret; struct servent *service; memset(tmp,'\0', 256); service = getservbyport(htons(port->port), port->proto); if (service) { snprintf(tmp, 255, "%s:%s", service->s_name, port->proto); } else { snprintf(tmp, 255, "%d:%s", port->port, port->proto); } ret = calloc((orig ? strlen(orig) : 0) + strlen(ret) + 2, sizeof(char)); Doing strlen() on uninit memory is deeply unwise. I'm not sure what the fix is for this. Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info: