易截截图软件、单文件、免安装、纯绿色、仅160KB

经典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


相关问答:

jsp中 <c:if test> 相关问题

在查询后将查询出来的值赋给各输入框
<c:if test="${not empty dataValue}">
      fm.SAMPLING_DATE.value=" <c:out value='${dataValue.SAMPLING_DATE}'/ ......

c基础

#include <string.h>
#include <stdio.h>

void main()
{
int i;
char buf[]="abcde";
strncpy(buf,"abc",3);
for(i=0;i <5;i++)
printf(&q ......

你们现在还在用C吗?C有前途吗?

你们现在还在用C吗?C有前途吗?
一定,并永远坚持

引用
一定,并永远坚持



有用。

楼主何出此言

楼主来c版问这个问题是踢馆用意吗哈哈

越来越冷是肯定的,完全淘汰倒也没那么容易

c ......

上海地区招聘C工程师

要求: 计算机或者通信专业
      熟悉C语言,有嵌入式开发经验
      1-2年工作经验(应届生如侧重系统、底层也可以)
              ......

上海地区招聘C工程师[

要求: 计算机或者通信专业
      熟悉C语言,有嵌入式开发经验
      1-2年工作经验(应届生如侧重系统、底层也可以)
            &nbs ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号