Skip to content

use strdup instead of manual malloc+memcpy #42

@ret2libc

Description

@ret2libc

In multiple places strings are copied from one place to another, but instead of using strdup or the str* functions, the project seems to prefer malloc+memcpy, which IMHO results in less readable more error-prone code.

Examples of this:

memcpy(rtd->key, key, sizeof(char)*keylen);

memcpy(ret, xmlstr, sizeof(char)*(strlen(xmlstr)+1));

memcpy(attr->name, name, sizeof(char)*(strlen(name)+1));

memcpy(attr->val, val, sizeof(char)*(strlen(val)+1));

.. and many others.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions