Alias Snippet
< Newer Topic
:: Older Topic >
Pages:<< prev 1 next >>
#1 Sep 23, 2009 1:44 am
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008
Well I installed it and only got one warning...
In function 'strncat',
inlined from 'check_alias' at alias.c:158:
/usr/include/bits/string3.h:153: warning: call to __builtin___strncat_chk might overflow destination buffer
Any ideas?
In function 'strncat',
inlined from 'check_alias' at alias.c:158:
/usr/include/bits/string3.h:153: warning: call to __builtin___strncat_chk might overflow destination buffer
strncat( arg, argument, MAX_INPUT_LENGTH );
Any ideas?
#2 Sep 23, 2009 10:37 am
Sorcerer
GroupMembers
Posts902
JoinedJan 29, 2007
What's the declaration for arg and argument here?
#3 Sep 23, 2009 11:35 am
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008
bool check_alias( CHAR_DATA * ch, char *command, char *argument ) { char arg[MAX_INPUT_LENGTH];
#4 Sep 23, 2009 11:36 am
Sorcerer
GroupMembers
Posts902
JoinedJan 29, 2007
It's probably complaining because you need space for the zero byte. Try
strncat( arg, argument, MAX_INPUT_LENGTH-1 );
strncat( arg, argument, MAX_INPUT_LENGTH-1 );
Pages:<< prev 1 next >>