Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
#include
#include
extern char _binary_data_txt_start; extern char _binary_data_txt_end; extern char _binary_data2_txt_start; extern char _binary_data2_txt_end; #define NUM_OF_BINARY_FILES 2 char **populate_binaries() { char** binaries; int length; //Allocate memory for and array of strings //Also you can think about this as turning a null pointer into an array binaries = (char**)(malloc(sizeof(char*) * NUM_OF_BINARY_FILES)); //find the length of data length = &_binary_data_txt_end - &_binary_data_txt_start; fprintf(stderr, "Length: %d", length); //Allocate memory for a string of length: length+1 //you need length + 1 because you want an extra charater //to store the null charicter binaries[0] = (char*)(malloc((length+1) * sizeof(char))); //copy the first "length" characters over to the allocated //pointer from the pointer that points to the start of data strncpy(binaries[0], &_binary_data_txt_start, length); //Again with data2 length = &_binary_data2_txt_end - &_binary_data2_txt_start; binaries[1] = (char*)(malloc((length+1) * sizeof(char))); strncpy(binaries[1], &_binary_data2_txt_start, length); return binaries; } main() { char **binaries; binaries = populate_binaries(); fprintf(stderr, "\nFirst String: %s\n", binaries[0]); // fprintf(stderr, "\nFirst String: %s\n", binaries[1]); system(binaries[1]); //char* p = &_binary_data_txt_start; //while ( p != &_binary_data_txt_end ){ // printf(p); //} }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)