]> sourceware.org Git - systemtap.git/commitdiff
runtime: tolerate overlong section/symbol names better
authorFrank Ch. Eigler <fche@elastic.org>
Wed, 10 Nov 2010 16:57:43 +0000 (11:57 -0500)
committerFrank Ch. Eigler <fche@elastic.org>
Wed, 10 Nov 2010 16:58:48 +0000 (11:58 -0500)
* 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

index 2e633d4b7c7dede4772c4f85f38cbb8a8f4a5216..d72e33589a1c84ae6b7e3f805e61fd953251a3a5 100644 (file)
@@ -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;
 
This page took 0.029221 seconds and 5 git commands to generate.