Files
kvmtool/include/kvm/strbuf.h
T
Cyrill Gorcunov 24ed52db06 kvm tools: Use safe string handling functions
Use str[n|l] functions to make sure destination is
not overflowed.

Seems socket path generation should be moved into
a separate helper, but it's for another patch.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:52 +01:00

21 lines
472 B
C

#ifndef __STRBUF_H__
#define __STRBUF_H__
#include <sys/types.h>
#include <string.h>
int prefixcmp(const char *str, const char *prefix);
extern size_t strlcat(char *dest, const char *src, size_t count);
extern size_t strlcpy(char *dest, const char *src, size_t size);
/* some inline functions */
static inline const char *skip_prefix(const char *str, const char *prefix)
{
size_t len = strlen(prefix);
return strncmp(str, prefix, len) ? NULL : str + len;
}
#endif