From 7c7b1cd59e2ab802efa9c200699e8fc3adfca0ac Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Wed, 10 Nov 2010 11:57:43 -0500 Subject: [PATCH] runtime: tolerate overlong section/symbol names better * runtime/staprun/staprun.c (send_a_relocation): Don't complain about overlong names, except if very verbose. Triple-check null termination of surviving strings. --- runtime/staprun/staprun.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/runtime/staprun/staprun.c b/runtime/staprun/staprun.c index 2e633d4b7..d72e33589 100644 --- a/runtime/staprun/staprun.c +++ b/runtime/staprun/staprun.c @@ -334,13 +334,17 @@ void send_a_relocation (const char* module, const char* reloc, unsigned long lon { struct _stp_msg_relocation msg; - if (strlen(module) >= STP_MODULE_NAME_LEN) - { _perr ("module name too long: %s", module); return; } - strcpy (msg.module, module); - - if (strlen(reloc) >= STP_SYMBOL_NAME_LEN) - { _perr ("reloc name too long: %s", reloc); return; } - strcpy (msg.reloc, reloc); + if (strlen(module) >= STP_MODULE_NAME_LEN-1) { + dbug (1, "module name too long: %s", module); + return; + } + strncpy (msg.module, module, STP_MODULE_NAME_LEN); + + if (strlen(reloc) >= STP_SYMBOL_NAME_LEN-1) { + dbug (1, "reloc name too long: %s", module); + return; + } + strncpy (msg.reloc, reloc, STP_MODULE_NAME_LEN); msg.address = address; -- 2.43.5