prepare for the release of rrdtool-1.2.18
[rrdtool.git] / src / rrd_graph.c
index a16734b..6df9b09 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * RRDtool 1.2.15  Copyright by Tobi Oetiker, 1997-2006
+ * RRDtool 1.2.18  Copyright by Tobi Oetiker, 1997-2006
  ****************************************************************************
  * rrd__graph.c  produce graphs from data in rrdfiles
  ****************************************************************************/
@@ -1446,7 +1446,27 @@ leg_place(image_desc_t *im)
        } else {
            prt_fctn = '\0';
        }
+       /* only valid control codes */
+        if (prt_fctn != 'l' && 
+           prt_fctn != 'n' && /* a synonym for l */
+           prt_fctn != 'r' &&
+           prt_fctn != 'j' &&
+           prt_fctn != 'c' &&
+           prt_fctn != 's' &&
+            prt_fctn != 't' &&
+            prt_fctn != '\0' &&
+            prt_fctn != 'g' ) {
+              free(legspace);
+              rrd_set_error("Unknown control code at the end of '%s\\%c'",im->gdes[i].legend,prt_fctn);
+                      return -1;
+
+       }
+
         /* remove exess space */
+        if ( prt_fctn == 'n' ){
+            prt_fctn='l';
+        }
+
         while (prt_fctn=='g' && 
               leg_cc > 0 && 
               im->gdes[i].legend[leg_cc-1]==' '){