]> sourceware.org Git - systemtap.git/commitdiff
PR11963: avoid using scanf %as
authorGrant Edwards <grant.b.edwards@gmail.com>
Wed, 1 Sep 2010 11:39:08 +0000 (07:39 -0400)
committerFrank Ch. Eigler <fche@elastic.org>
Wed, 1 Sep 2010 11:39:08 +0000 (07:39 -0400)
runtime/staprun/staprun.c

index 57f25d2c460fb1134415320cb99bd8a404cfe76f..dc36fc342916d0cb7e77e6719b9ad83efdb06a7d 100644 (file)
@@ -368,17 +368,16 @@ int send_relocation_kernel ()
             {
               unsigned long long address;
               char type;
-              char* symbol = NULL;
-              int rc = sscanf (line, "%llx %c %as", &address, &type, &symbol);
+              char symbol[linesize];
+              int rc = sscanf (line, "%llx %c %s", &address, &type, symbol);
               free (line); line=NULL;
-              if (symbol == NULL) continue; /* OOM? */
 
 #ifdef __powerpc64__
 #define KERNEL_RELOC_SYMBOL ".__start"
 #else
 #define KERNEL_RELOC_SYMBOL "_stext"
 #endif
-              if ((rc == 3) && (0 == strcmp(symbol,KERNEL_RELOC_SYMBOL)))
+              if ((rc == 3) && symbol[0] && (0 == strcmp(symbol,KERNEL_RELOC_SYMBOL)))
                 {
                   /* NB: even on ppc, we use the _stext relocation name. */
                   send_a_relocation ("kernel", "_stext", address);
@@ -386,8 +385,6 @@ int send_relocation_kernel ()
                   /* We need nothing more from the kernel. */
                   done_with_kallsyms=1;
                 }
-
-              free (symbol);
             }
         }
       fclose (kallsyms);
This page took 0.027974 seconds and 5 git commands to generate.