forked from github/server
CID 172474 + 173899 Copy into fixed size buffer
This commit is contained in:
parent
30777e5948
commit
d8c063ae50
|
@ -2,6 +2,7 @@
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
#include "keyword.h"
|
#include "keyword.h"
|
||||||
|
|
||||||
|
#include <util/bsdstring.h>
|
||||||
#include <util/language.h>
|
#include <util/language.h>
|
||||||
#include <util/umlaut.h>
|
#include <util/umlaut.h>
|
||||||
#include <util/log.h>
|
#include <util/log.h>
|
||||||
|
@ -20,7 +21,7 @@ const char * keyword(keyword_t kwd)
|
||||||
if (!result[0]) {
|
if (!result[0]) {
|
||||||
strcpy(result, "keyword::");
|
strcpy(result, "keyword::");
|
||||||
}
|
}
|
||||||
strcpy(result + 9, keywords[kwd]);
|
strlcpy(result + 9, keywords[kwd], sizeof(result) - 9);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "bsdstring.h"
|
||||||
#include "unicode.h"
|
#include "unicode.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
@ -211,7 +212,7 @@ void addtoken(tnode ** root, const char *str, variant id)
|
||||||
if (lcs == replace[i].ucs) {
|
if (lcs == replace[i].ucs) {
|
||||||
char zText[1024];
|
char zText[1024];
|
||||||
memcpy(zText, replace[i].str, 3);
|
memcpy(zText, replace[i].str, 3);
|
||||||
strcpy(zText + 2, (const char *)str + len);
|
strlcpy(zText + 2, (const char *)str + len, sizeof(zText)-2);
|
||||||
addtoken(root, zText, id);
|
addtoken(root, zText, id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue