summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKen'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>2009-12-11 12:22:19 +0900
committerDhaval Giani <dhaval@linux.vnet.ibm.com>2009-12-16 14:06:40 +0530
commit296a3aade28ab5d5d5cdeb4c1b046eb87af54384 (patch)
tree85df38e5c6d680aacd5dd6c04845685a909d9f69 /src
parentbf09f042ac65dacc776279da948abd39c8e9d36b (diff)
downloadlibcg-296a3aade28ab5d5d5cdeb4c1b046eb87af54384.tar.gz
libcg-296a3aade28ab5d5d5cdeb4c1b046eb87af54384.tar.xz
libcg-296a3aade28ab5d5d5cdeb4c1b046eb87af54384.zip
Fix an invalid access to yytext.
Hi, I tested "cgconfig" service with a big /etc/cgconfig.conf file, and the service failed by signal SIGSEGV. There are two problems. The first is that "cgconfig" service fails with a big /etc/cgconfig.conf file. The second is that the error handling is stopped by signal SIGSEGV. This patch fixes the second problem. The following is the gdb output of the problem. You can see the problem happens in yyerror(). # gdb cgconfigparser (gdb) run -l /etc/cgconfig.conf Starting program: /usr/local/sbin/cgconfigparser -l /etc/cgconfig.conf [Thread debugging using libthread_db enabled] [New Thread 139764254320624 (LWP 15169)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 139764254320624 (LWP 15169)] 0x00007f1d66bd1604 in yyerror (s=0x7f1d66bd955a "syntax error") at parse.y:30 30 fprintf(stderr, "error at line number %d at %c:%s", line_no, *yytext, (gdb) bt #0 0x00007f1d66bd1604 in yyerror (s=0x7f1d66bd955a "syntax error") at parse.y:30 #1 0x00007f1d66bd1a9e in yyparse () at parse.c:1689 #2 0x00007f1d66bd79b5 in cgroup_config_load_config ( pathname=<value optimized out>) at config.c:467 #3 0x00000000004008a3 in main (argc=3, argv=0x7fffa20c8358) at cgconfig.c:60 (gdb) This problem is due to an invalid access to yytext, and this patch fixes it. (If you need a big /etc/cgconfig.conf file for reproducing the problem, please let me know it. I will send it to you without the mailing list.) Thanks Ken'ichi Ohmichi Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> Acked-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/parse.y2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/parse.y b/src/parse.y
index 45de0eb..32a3c74 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -26,7 +26,7 @@ extern char *yytext;
void yyerror(char *s)
{
- fprintf(stderr, "error at line number %d at %c:%s", line_no, *yytext,
+ fprintf(stderr, "error at line number %d at %s:%s\n", line_no, yytext,
s);
}