diff -ruN IRRToolSet-4.8.5/src/Core/util/Buffer.cc IRRToolSet-4.8.5-patched/src/Core/util/Buffer.cc
--- IRRToolSet-4.8.5/src/Core/util/Buffer.cc	2006-10-09 19:05:14.000000000 +0300
+++ IRRToolSet-4.8.5-patched/src/Core/util/Buffer.cc	2010-04-15 10:09:33.000000000 +0300
@@ -174,7 +174,8 @@
 
 void Buffer::extend(unsigned long minExtend) {
    assert(!callerAllocated);	// !!!
-   capacity = (capacity + BufferExtendIncrement) >? (size + minExtend);
+   // capacity = (capacity + BufferExtendIncrement) >? (size + minExtend);
+   capacity = ((capacity + BufferExtendIncrement) > capacity) ? (capacity + BufferExtendIncrement) : (size + minExtend);
    contents = (char *)realloc(contents, capacity);
 }
 
diff -ruN IRRToolSet-4.8.5/src/rpsl/rpsl/prefix.cc IRRToolSet-4.8.5-patched/src/rpsl/rpsl/prefix.cc
--- IRRToolSet-4.8.5/src/rpsl/rpsl/prefix.cc	2007-02-09 21:46:31.000000000 +0200
+++ IRRToolSet-4.8.5-patched/src/rpsl/rpsl/prefix.cc	2010-04-15 10:09:33.000000000 +0300
@@ -278,7 +278,8 @@
    default: // ^n-m
       if (_m < n || _m < n)
 	 return false;
-      n = (_n >? n);
+      // n = (_n >? n);
+      n = (_n > n) ? _n : n;
       m = _m;
    }
 
@@ -705,7 +706,8 @@
    default: // ^n-m
       if (_m < n || _m < n)
          return false;
-      n = (_n >? n);
+      // n = (_n >? n);
+      n = (_n > n) ? _n : n;
       m = _m;
    }
 
diff -ruN IRRToolSet-4.8.5/src/RtConfig/f_cisco.cc IRRToolSet-4.8.5-patched/src/RtConfig/f_cisco.cc
--- IRRToolSet-4.8.5/src/RtConfig/f_cisco.cc	2007-01-23 02:45:16.000000000 +0200
+++ IRRToolSet-4.8.5-patched/src/RtConfig/f_cisco.cc	2010-04-15 10:33:05.000000000 +0300
@@ -748,15 +748,18 @@
    int lineLen = out.str().length();
    if (lineLen < 240 && ! hasTilda) {
       const char *p = out.str().c_str();
-      for (char *q = strchr(p, '@'); q; q = strchr(q, '@'))
+      // for (char *q = strchr(p, '@'); q; q = strchr(q, '@'))
+      for (char *q = strchr((char*)p, '@'); q; q = strchr(q, '@'))
 	 *q = '(';
       s << out.str();
    } else { // need to split into multiple lines
       if (hasTilda) {
 	 const char *p = out.str().c_str();
-	 for (char *q = strchr(p, '@'); q; q = strchr(q, '@'))
+	 // for (char *q = strchr(p, '@'); q; q = strchr(q, '@'))
+	 for (char *q = strchr((char*)p, '@'); q; q = strchr(q, '@'))
 	    *q = '(';
-	 for (char *q = strchr(p, '&'); q; q = strchr(q, '&'))
+	 // for (char *q = strchr(p, '&'); q; q = strchr(q, '&'))
+	 for (char *q = strchr((char*)p, '&'); q; q = strchr(q, '&'))
 	    *q = '@';
       }
 
@@ -777,7 +780,9 @@
 	 s << out.str();
 	 cerr << "Warning: ip as-path access-list is too long for cisco to handle" << endl;
       } else {
-	 int inc = hasTilda ? 1 : (240 - lineLen + size) >? 5;
+	 // int inc = hasTilda ? 1 : (240 - lineLen + size) >? 5;
+	 int inc = hasTilda ? 1 :
+	 		( ( (240 - lineLen + size) > 5 ) ? (240 - lineLen + size) : 5 );
 	 p = strdup(out.str().c_str());
 	 q = strchr(r, ')') + 1;
 	 *r = 0;

