Skip to content

addServiceRecord crashes in MDNS.cpp #36

Open
@dkgoodman

Description

@dkgoodman

In more than one location, space is created with something like:

char* mem = malloc( strlen( text ) );

followed by something like:

strcpy(mem, text);

This only mallocs enough memory for the number of characters in the text, but not for the terminating null, so that the strcpy writes outside the bounds of the allocated memory.

Better to do something like:

char* mem = malloc( strlen(text) + 1 ); // so that there's room for the terminating null.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions