projects
/
runtime.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
02ad642
)
check for correct length of debug string before copying it.
author
Pekka Riikonen
<priikone@silcnet.org>
Tue, 18 Jun 2002 07:10:43 +0000
(07:10 +0000)
committer
Pekka Riikonen
<priikone@silcnet.org>
Tue, 18 Jun 2002 07:10:43 +0000
(07:10 +0000)
lib/silcutil/silclog.c
patch
|
blob
|
history
diff --git
a/lib/silcutil/silclog.c
b/lib/silcutil/silclog.c
index dc74ace1492e06ae4f3e13cb9e552389f60b6873..176c3eb73092be7156a56bf154af73a9e9868885 100644
(file)
--- a/
lib/silcutil/silclog.c
+++ b/
lib/silcutil/silclog.c
@@
-488,11
+488,15
@@
void silc_log_reset_debug_callbacks()
void silc_log_set_debug_string(const char *debug_string)
{
char *string;
void silc_log_set_debug_string(const char *debug_string)
{
char *string;
+ int len;
if ((strchr(debug_string, '(') && strchr(debug_string, ')')) ||
strchr(debug_string, '$'))
string = strdup(debug_string);
else
string = silc_string_regexify(debug_string);
if ((strchr(debug_string, '(') && strchr(debug_string, ')')) ||
strchr(debug_string, '$'))
string = strdup(debug_string);
else
string = silc_string_regexify(debug_string);
- strncpy(silc_log_debug_string, string, strlen(string));
+ len = strlen(string);
+ if (len >= sizeof(silc_log_debug_string))
+ len = sizeof(silc_log_debug_string) - 1;
+ strncpy(silc_log_debug_string, string, len);
silc_free(string);
}
silc_free(string);
}