经典C程序求解
Problem 1
Read Ken Thompson's article ...
char s[] = {
'\t',
'0',
'\n',
'}',
';",
'\n',
'\n',
'/',
'*',
'\n',
(213 lines deleted)
0
};
/* The string s is a
* representation of the body
* of this program from '0'
* to the end.
*/
main(){
int i;
printf("char\ts{ } = {\n");
for(i=0; s[i]; i++)
printf("\t%d,\n",s[i]);
printf("%s",s);
}
Compile and run this program. You will have to figure out what goes in the 213 deleted lines. If you want, you can leave the comment out of the string s and out of the program. Explain the output. By itself, this program does not pose any sort of security threat. Explain in your own words what this program has to do with Thompson's Trojan Horse attack.
没看懂。
printf("%s",s); 执行这句的时候,s[1]的'0'为什么没打出来呢?
up
找到那个'0'了,刚才看错行了。
不过还是没看明白木马是怎么回事
mark
找到原文了,这是Ken Thompson获得图灵奖的演讲的一部分。
这段代码是一个例子,它可以产生具有自我复制能力的程序。
不过……还是没看懂
Figure 1 shows a s
相关问答:
以前在VC里面建一个工程,都只用一个 .c 文件,昨天在一个工程里用了两个 .c文件了,遇到问题了,请大家指点。比如:
File1.c Fil ......
编译普通的c没问题啊,但编译javah生成的就报错:
gcc -O0 -g3 -Wall -c -fmessage-length=0 -oHelloWorld.o ..\HelloWorld.c
gcc -otest.exe HelloWorld.o
d:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../. ......
编写程序detab, 将输入中的制表符替换成适当数目的空格,使空格充满到下一个制表符终止的地方。假设制表符终止位的位置是固定的,比如每隔n列就会出现一个制表符终止位。
------------------- ......
C\C++如何计算函数的导数,本人新手,想写个程序,但是不知道如何下手,还望高手指点一二,谢过。
这个……
跟函数的具体形式有关吧,难道你想编出个“万能”的求导函数?
俺上学时想过自动推导公式,后来 ......
如下哪些是java中有效地关键字?
a。 const b。 NULL c。 false d。 this e。 native
C D E
a b c d e
除了B
abcd好像都是,不知道e是不是,没见过
引 ......