Explorar o código

* Fixed an rmspace() segfault bug

svn: 424
Bryan Drewery %!s(int64=22) %!d(string=hai) anos
pai
achega
35a87efb0b
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      src/chanprog.c

+ 2 - 1
src/chanprog.c

@@ -61,7 +61,8 @@ void rmspace(char *s)
 
   /* Wipe end of string */
   for (p = s + strlen(s) - 1; ((whitespace(*p)) && (p >= s)); p--);
-  *(p + 1) = 0;
+  if (p != s + strlen(s) - 1)
+    *(p + 1) = 0;
   len = p+1 - s;
   for (p = s; ((whitespace(*p)) && (*p)); p++);
   len -= (p - s);