aboutsummaryrefslogtreecommitdiff
path: root/lib/util.h
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-02-22 10:58:36 -0800
committerBen Pfaff <blp@nicira.com>2011-02-22 16:33:58 -0800
commit71d7c22f54ae32d15133571e09ddf7ab435e8afa (patch)
treecfdb28ddeebded6fe6400eb2dd6747a4d769aa45 /lib/util.h
parente868fb3d322f5c46385f1fc6db5bb1ab33f90305 (diff)
util: New function ovs_strzcpy().
Static analyzers hate strncpy(). This new function shares its property of initializing an entire buffer, without its nasty habit of failing to null-terminate long strings. Coverity #10697,10696,10695,10694,10693,10692,10691,10690.
Diffstat (limited to 'lib/util.h')
-rw-r--r--lib/util.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/util.h b/lib/util.h
index f3bf80c6..e741067a 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, 2010 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -133,6 +133,7 @@ char *xvasprintf(const char *format, va_list) PRINTF_FORMAT(1, 0) MALLOC_LIKE;
void *x2nrealloc(void *p, size_t *n, size_t s);
void ovs_strlcpy(char *dst, const char *src, size_t size);
+void ovs_strzcpy(char *dst, const char *src, size_t size);
void ovs_fatal(int err_no, const char *format, ...)
PRINTF_FORMAT(2, 3) NO_RETURN;