diff options
author | Ben Pfaff <blp@nicira.com> | 2011-02-22 10:58:36 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2011-02-22 16:33:58 -0800 |
commit | 71d7c22f54ae32d15133571e09ddf7ab435e8afa (patch) | |
tree | cfdb28ddeebded6fe6400eb2dd6747a4d769aa45 /lib/util.h | |
parent | e868fb3d322f5c46385f1fc6db5bb1ab33f90305 (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.h | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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; |