Bug 161751
Summary: | buffer overflow in genkdmconf | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Andrea Santilli <sacntct> | ||||
Component: | kdebase | Assignee: | Than Ngo <than> | ||||
Status: | CLOSED UPSTREAM | QA Contact: | Ben Levenson <benl> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | medium | ||||||
Version: | 4 | Keywords: | Security | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | i686 | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2005-06-27 12:01:54 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: |
|
Description
Andrea Santilli
2005-06-26 23:54:04 UTC
*** Bug 161752 has been marked as a duplicate of this bug. *** Created attachment 116007 [details]
fix for genkdmconf.c
As you can see by the attachment, nname shouldn't be of a fixed size cos if it installs its README in a very long pathname there will be the buffer overflow. This happened to me because I was rebuilding the srpm and the $DESTDIR was very long ooops! please correct that + nname=malloc(sizeof(char)*strlen(newdir)+8); //strlen doesn't count the final nul in + nname=malloc(sizeof(char)*(strlen(newdir)+8)); //strlen doesn't count the final nul I think, it is better to use ASPrintf. the fix is: --- kdebase-3.4.1/kdm/kfrontend/genkdmconf.c.tn 2005-06-27 13:30:11.000000000 +0200 +++ kdebase-3.4.1/kdm/kfrontend/genkdmconf.c 2005-06-27 13:52:40.000000000 +0200 @@ -2560,7 +2560,7 @@ int i, ap, newer, locals, foreigns; int no_old_xdm = 0, no_old_kde = 0; struct stat st; - char nname[80]; + char *nname; for (ap = 1; ap < argc; ap++) { if (!strcmp( argv[ap], "--help" )) { @@ -2801,7 +2801,7 @@ wrconf( f ); fclose( f ); - sprintf( nname, "%s/README", newdir ); + ASPrintf( &nname, "%s/README", newdir ); f = Create( nname, 0644 ); fprintf( f, "This automatically generated configuration consists of the following files:\n" ); The next kde rebuild (KDE-3.4.2) will include the fix. Many thanks for your report and bugfix. |