[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: Re: kdebase/kioslave/thumbnail [INSECURITY]
From: Oswald Buddenhagen <ossi () kde ! org>
Date: 2002-12-04 11:33:19
[Download RAW message or body]
On Wed, Dec 04, 2002 at 11:29:57AM +0100, Oswald Buddenhagen wrote:
> a rudimentary c++ parser would preprocess the old and the new revision
> by stripping comments and text in strings.
> [...]
> volunteers make one step ahead ... [/me makes one step aback] :)
>
actually, the preprocessor is almost trivial. attached.
possible todo: special-casing for strings in #includes.
dirk: have fun with it. :)
greetings
--
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.
["untextify.c" (text/x-csrc)]
/*
* This program reads from stdin, strips all c/c++ comments, makes all
* c strings empty and outputs the result to stdout.
*
* written by Oswald Buddenhagen <ossi@kde.org>
*
* This file is free software in terms of the BSD licence. That means
* that you can do anything with it except removing this license or
* the above copyright notice. There is NO WARRANTY of any kind.
*
*/
#include <stdio.h>
int
main()
{
int c;
c = getchar();
while (c != EOF) {
if (c == '"') {
putchar (c);
while ((c = getchar()) != EOF && c != '"') {
if (c == '\\')
c = getchar();
if (c == '\n')
putchar (c);
}
putchar (c);
} else if (c == '/') {
c = getchar();
if (c == '/') {
while ((c = getchar()) != EOF && c != '\n');
putchar (c);
} else if (c == '*') {
c = getchar();
while (c != EOF) {
if (c == '\n')
putchar (c);
else if (c == '*') {
c = getchar();
if (c == '/')
break;
continue;
}
c = getchar();
}
} else {
putchar ('/');
continue;
}
} else
putchar (c);
c = getchar();
}
return 0;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic