Update of /cvsroot/sblim/sfcb
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv7546
Modified Files:
mofpp.c ChangeLog NEWS
Log Message:
[ 3054618 ] mofpp is overaggressive when detecting comments
Index: mofpp.c
===================================================================
RCS file: /cvsroot/sblim/sfcb/mofpp.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- mofpp.c 8 Sep 2009 09:05:08 -0000 1.6
+++ mofpp.c 18 Nov 2010 23:14:30 -0000 1.7
@@ -70,10 +70,11 @@
void processFile(char *fn, FILE *in, FILE *out)
{
- char *s,*e,rec[10000],*ifn=NULL;
+ char *s,*e,*es,rec[10000],*ifn=NULL;
FILE *incFile;
int comment=0;
int nl=0;
+ int qs=0;
while (fgets(rec, sizeof(rec), in)) {
nl++;
@@ -108,28 +109,42 @@
}
}
- while ((s = strstr(s,"/"))) {
- if (*(s+1) == '/') {
- if ((e = strstr(s+2,"\r\n"))) {
- strcpy(s,e+2);
- } else if ((e = strstr(s+2,"\n"))) {
- strcpy(s,e+1);
- } else {
- *s = 0;
- comment = 1;
- break;
- }
- } else if (*(s+1) == '*') {
- if ((e = strstr(s+2,"*/"))) {
- strcpy(s,e+2);
- } else {
- *s = 0;
- comment = 2;
- break;
- }
- } else {
- s++;
- }
+ while ((*s == ' ') || (*s == '\t')) {
+ s++;
+ }
+ es = s;
+ qs = 0;
+ if (*s == '"') {
+ qs = 1;
+ /* find end of the string */
+ es++;
+ while ((s = strstr(es, "\""))) {
+ es = s+1; /* end of quoted string */
+ }
+ }
+
+ while ((s = strstr(es, "/"))) {
+ if (*(s+1) == '/') {
+ if ((e = strstr(s+2,"\r\n"))) {
+ strcpy(s,e+2);
+ } else if ((e = strstr(s+2,"\n"))) {
+ strcpy(s,e+qs);
+ } else {
+ *s = 0;
+ comment = 1;
+ break;
+ }
+ } else if (*(s+1) == '*') {
+ if ((e = strstr(s+2,"*/"))) {
+ strcpy(s,e+2);
+ } else {
+ *s = 0;
+ comment = 2;
+ break;
+ }
+ } else {
+ s++;
+ }
}
fprintf(out,"%s",rec);
Index: NEWS
===================================================================
RCS file: /cvsroot/sblim/sfcb/NEWS,v
retrieving revision 1.563
retrieving revision 1.564
diff -u -d -r1.563 -r1.564
--- NEWS 17 Nov 2010 16:18:51 -0000 1.563
+++ NEWS 18 Nov 2010 23:14:30 -0000 1.564
@@ -11,6 +11,7 @@
- 3097310 localConnect in cimcClientSfcbLocal.c accesses free'd memory
- 3087577 Provider MI accessed before finished initializing
- 3109469 Potential Buffer Overflow in msgqueue.c:localConnectServer()
+- 3054618 mofpp is overaggressive when detecting comments
Changes in 1.3.9
================
Index: ChangeLog
===================================================================
RCS file: /cvsroot/sblim/sfcb/ChangeLog,v
retrieving revision 1.636
retrieving revision 1.637
diff -u -d -r1.636 -r1.637
--- ChangeLog 17 Nov 2010 16:18:51 -0000 1.636
+++ ChangeLog 18 Nov 2010 23:14:30 -0000 1.637
@@ -1,3 +1,8 @@
+2010-11-18 Chris Buccella <buc...@li...>
+
+ * mofpp.c:
+ [ 3054618 ] mofpp is overaggressive when detecting comments
+
2010-11-17 Chris Buccella <buc...@li...>
* msgqueue.c:
|