centos 7
buffer weakness #3

5

Weakness Breakdown


Definition:

Buffer overflows are one of the most well-known software vulnerabilities. Even though most developers know what buffer overflows are, attacks against the vulnerabilities are common in both legacy and newer applications. A classic buffer overflow exploit begins with the attacker sending data to a program, which it then stores in an undersized stack buffer. Besides stack buffer overflows, other kinds of buffer overflows include heap overflows, off-by-one errors and many others. Learn more about buffer overflows on OWASP attack index.

Warning code(s):

Easily used incorrectly.

File Name:

nfs4-acl-tools-0.3.3/libnfs4acl/nfs4_remove_file_aces.c

Context:

The highlighted line of code below is the trigger point of this particular Centos 7 buffer weakness.

  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 *  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <stdio.h>
#include <string.h>
#include "libacl_nfs4.h"

/*
 * nfs4_remove_file_aces - read ACE entries from acl_spec string contained
 * 			in "fd" and remove them from "acl"
 * output: 0 on success, -1 if error occurs
 */
int nfs4_remove_file_aces(struct nfs4_acl *acl, FILE *fd)
{
	char ace_buf[NFS4_MAX_ACESIZE];
	char acl_spec[NFS4_MAX_ACLSIZE];

	memset(acl_spec, '\0', NFS4_MAX_ACLSIZE);
	while (fgets(ace_buf, NFS4_MAX_ACESIZE, fd) != NULL)
		strncat(acl_spec, ace_buf, NFS4_MAX_ACESIZE);

	return nfs4_remove_string_aces(acl, acl_spec);
} 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.