error #8055: The procedure has a dummy argument that has the ALLOCATABLE, ASYNCHRONOUS, OPTIONAL, POINTER, TARGET, VALUE or VOLATILE attribute. Required explicit interface is missing from original source. [GPARRAY]
时间: 2024-03-31 15:38:07 浏览: 334
这个错误是因为你在一个过程的参数列表中使用了ALLOCATABLE、ASYNCHRONOUS、OPTIONAL、POINTER、TARGET、VALUE或VOLATILE这些属性中的一个或多个。这些属性会导致该参数需要显式接口,但是你的程序中没有提供这个接口。要解决这个错误,你需要在调用这个过程之前,在程序的某个地方提供该过程的显式接口。可以通过在过程中使用INTERFACE块来提供显式接口,或者将过程放在MODULE中,在调用过程时使用USE语句来自动获取过程的接口。
相关问题
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <sys/socket.h> #include <netinet/ip.h> #define PORT 9090 /* Changing this size will change the layout of the stack. * We have added 2 dummy arrays: in main() and myprintf(). * Instructors can change this value each year, so students * won’t be able to use the solutions from the past. * Suggested value: between 0 and 300 */ #ifndef DUMMY_SIZE #define DUMMY_SIZE 100 #endif char *secret = "A secret message\n"; unsigned int target = 0x11223344; void myprintf(char *msg) { uintptr_t framep; // Copy the ebp value into framep, and print it out asm("movl %%ebp, %0" : "=r"(framep)); printf("The ebp value inside myprintf() is: 0x%.8x\n", framep); /* Change the size of the dummy array to randomize the parameters for this lab. Need to use the array at least once */ char dummy[DUMMY_SIZE]; memset(dummy, 0, DUMMY_SIZE); // This line has a format string vulnerability printf(msg); printf("The value of the ’target’ variable (after): 0x%.8x\n", target); }
这段代码存在一个格式化字符串漏洞,容易受到攻击者的利用。攻击者可以通过特殊的格式化字符串来读取或写入内存中的任意位置。具体来说,攻击者可以在传递给myprintf()函数的字符串中添加%c或%s等特殊字符,来读取内存中的任意位置。攻击者也可以使用%hn或%n等格式化字符串,来将值写入内存中的任意位置。例如,攻击者可以使用以下格式化字符串来将0x11223344写入target变量的地址0x0804a028处:
./vulnerable $(python -c "print('\x28\xa0\x04\x08' + '%4c%hn'*2)")
解释代码#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <sys/socket.h> #include <netinet/ip.h> #define PORT 9090 /* Changing this size will change the layout of the stack. * We have added 2 dummy arrays: in main() and myprintf(). * Instructors can change this value each year, so students * won't be able to use the solutions from the past. * Suggested value: between 0 and 300 */ #ifndef DUMMY_SIZE #define DUMMY_SIZE 100 #endif char *secret = "A secret message\n"; unsigned int target = 0x11223344; void myprintf(char *msg) { uintptr_t framep; // Copy the ebp value into framep, and print it out asm("movl %%ebp, %0" : "=r"(framep)); printf("The ebp value inside myprintf() is: 0x%.8x\n", framep); /* Change the size of the dummy array to randomize the parameters for this lab. Need to use the array at least once */ char dummy[DUMMY_SIZE]; memset(dummy, 0, DUMMY_SIZE); // This line has a format-string vulnerability printf(msg); printf("The value of the 'target' variable (after): 0x%.8x\n", target); } /* This function provides some helpful information. It is meant to * simplify the lab tasks. In practice, attackers need to figure * out the information by themselves. */ void helper() { printf("The address of the secret: 0x%.8x\n", (unsigned) secret); printf("The address of the 'target' variable: 0x%.8x\n", (unsigned) &target); printf("The value of the 'target' variable (before): 0x%.8x\n", target); }
这段代码定义了两个全局变量:指向字符串的指针 `secret` 和一个无符号整数 `target`。同时定义了一个名为 `myprintf` 的函数,该函数接受一个指向字符的指针,并将其作为格式化字符串打印到标准输出中。该函数中还使用了一个名为 `dummy` 的数组,在函数内部没有实际用途,只是为了随机化函数参数。在函数中还打印了 `ebp` 的值,以便在后面的漏洞利用中定位栈帧。同时,该代码还定义了一个名为 `helper` 的函数,用于打印一些有用的信息,便于后续的漏洞利用。
阅读全文