mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-10-18 22:33:55 +00:00
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>
21 lines
472 B
C
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
|