[Openvas-commits] r5465 - in trunk/openvas-manager: . src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Oct 9 17:25:04 CEST 2009


Author: mattm
Date: 2009-10-09 17:25:03 +0200 (Fri, 09 Oct 2009)
New Revision: 5465

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/src/omp.c
Log:
	* src/omp.c (latex_escape_text): Replace $\backslash with $\\backslash in
	string literals.  Adjust the backslash case to move the correct portion
	of the string forward, and to move the character pointer to the correct
	final location.

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2009-10-09 14:40:26 UTC (rev 5464)
+++ trunk/openvas-manager/ChangeLog	2009-10-09 15:25:03 UTC (rev 5465)
@@ -1,5 +1,12 @@
 2009-10-09  Matthew Mundell <matthew.mundell at intevation.de>
 
+	* src/omp.c (latex_escape_text): Replace $\backslash with $\\backslash in
+	string literals.  Adjust the backslash case to move the correct portion
+	of the string forward, and to move the character pointer to the correct
+	final location.
+
+2009-10-09  Matthew Mundell <matthew.mundell at intevation.de>
+
 	* src/tasks_sql.h (report_notes, report_warnings): Add missing args to
 	calls.
 

Modified: trunk/openvas-manager/src/omp.c
===================================================================
--- trunk/openvas-manager/src/omp.c	2009-10-09 14:40:26 UTC (rev 5464)
+++ trunk/openvas-manager/src/omp.c	2009-10-09 15:25:03 UTC (rev 5465)
@@ -1913,7 +1913,7 @@
     const char *c = text;
     while (*c) { if (*c == '\\') bs++; c++; }
     new = g_strndup (text,
-                     (left - bs) * 2 + bs * (strlen ("$\backslash$") - 1) + 1);
+                     (left - bs) * 2 + bs * (strlen ("$\\backslash$") - 1) + 1);
   }
 
   ch = new;
@@ -1944,9 +1944,12 @@
               default:
                 {
                   /* \ becomes $\backslash$ */
-                  memmove (ch - 1 + strlen ("$\backslash$"), ch - 1, left);
-                  strncpy (ch - 1, "$\backslash$", strlen ("$\backslash$"));
-                  ch += (strlen ("$\backslash$") - 1);
+                  memmove (ch - 1 + strlen ("$\\backslash$"), ch, left);
+                  strncpy (ch - 1, "$\\backslash$", strlen ("$\\backslash$"));
+                  /* Get back to the position of the original backslash. */
+                  ch--;
+                  /* Move over the newly inserted characters. */
+                  ch += (strlen ("$\\backslash$") - 1);
                   break;
                 }
             }



More information about the Openvas-commits mailing list