MCPcopy Create free account
hub / github.com/F12FLASH/CTF / vulnerable_function

Function vulnerable_function

4.Stackless Stack/public/downloads/stackless_stack.c:157–178  ·  view source on GitHub ↗

* @brief Vulnerable function containing buffer overflow * @param region Pointer to memory region structure */

Source from the content-addressed store, hash-verified

155 * @param region Pointer to memory region structure
156 */
157void vulnerable_function(memory_region_t *region) {
158 char local_buffer[64]; // Small local buffer
159
160 const char *prompt = "[💀] Enter your exploit payload: ";
161 write(STDOUT_FILENO, prompt, strlen(prompt));
162
163 ssize_t bytes_read = read(STDIN_FILENO, region->data, MAX_INPUT);
164
165 if (bytes_read > 0) {
166 char status_msg[128];
167 int msg_len = snprintf(status_msg, sizeof(status_msg),
168 "[📥] Received %ld bytes at address %p\n",
169 bytes_read, region->data);
170 write(STDERR_FILENO, status_msg, msg_len);
171 }
172
173 // Trigger callback if magic value matches
174 if (region->magic == MAGIC_VALUE && region->callback != NULL) {
175 write(STDOUT_FILENO, "[⚡] Executing callback function...\n", 35);
176 region->callback(region->data);
177 }
178}
179
180/**
181 * @brief Cleanup resources

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected