Skip to content

Commit 0308fae

Browse files
author
Charlie Gordon
committed
prevent spurious uses of strncpy/strtok
1 parent 65e7ae7 commit 0308fae

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cutils.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/*
22
* Various simple C utilities
33
*
4-
* Copyright (c) 2000, 2001, 2002 Fabrice Bellard.
4+
* Copyright (c) 2000-2002 Fabrice Bellard.
5+
* Copyright (c) 2000-2014 Charlie Gordon.
56
*
67
* This library is free software; you can redistribute it and/or
78
* modify it under the terms of the GNU Lesser General Public
@@ -30,6 +31,11 @@
3031
#define pstrcat(buf, sz, str) qe_pstrcat(buf, sz, str)
3132
#define pstrncpy(buf, sz, str, n) qe_pstrncpy(buf, sz, str, n)
3233

34+
#undef strncpy
35+
#define strncpy(d,s) do_not_use_strncpy!!(d,s)
36+
#undef strtok
37+
#define strtok(str,sep) do_not_use_strtok!!(str,sep)
38+
3339
int strstart(const char *str, const char *val, const char **ptr);
3440
char *pstrcpy(char *buf, int buf_size, const char *str);
3541
char *pstrcat(char *buf, int buf_size, const char *s);

0 commit comments

Comments
 (0)