aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorNaohiro Ooiwa <nooiwa@miraclelinux.com>2009-06-28 14:30:38 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2009-06-28 14:30:38 +0300
commitd80d146b2c78a9ea114748129cde0fae017bbfbc (patch)
tree5dda449aa7ad1542f8025f46b8f12d1e8743c1a9 /src/main.c
parentcf07f316b773f552dbebeeac4a1220e8e7c968d0 (diff)
downloadcflow-d80d146b2c78a9ea114748129cde0fae017bbfbc.tar.gz
cflow-d80d146b2c78a9ea114748129cde0fae017bbfbc.tar.bz2
Fix coredump (tiny change)
* src/main.c (symbol_override): Fix conditional logic to prevent coredump on invalid usage. Require that the argument always have ':' in it.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 23c2aaa..5ad565a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,5 +1,5 @@
1/* This file is part of GNU cflow 1/* This file is part of GNU cflow
2 Copyright (C) 1997,2005,2007 Sergey Poznyakoff 2 Copyright (C) 1997,2005,2007,2009 Sergey Poznyakoff
3 3
4 GNU cflow is free software; you can redistribute it and/or modify 4 GNU cflow is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -257,14 +257,16 @@ symbol_override(const char *str)
257 Symbol *sp; 257 Symbol *sp;
258 258
259 ptr = strchr(str, ':'); 259 ptr = strchr(str, ':');
260 if (*ptr == ':') { 260 if (!ptr) {
261 error(0, 0, _("%s: no symbol type supplied"), str);
262 return;
263 } else {
261 type = find_option_type(symbol_optype, ptr+1, 0); 264 type = find_option_type(symbol_optype, ptr+1, 0);
262 if (type == 0) { 265 if (type == 0) {
263 error(0, 0, _("unknown symbol type: %s"), ptr+1); 266 error(0, 0, _("unknown symbol type: %s"), ptr+1);
264 return; 267 return;
265 } 268 }
266 } else 269 }
267 type = IDENTIFIER;
268 name = strndup(str, ptr - str); 270 name = strndup(str, ptr - str);
269 sp = install(name); 271 sp = install(name);
270 sp->type = SymToken; 272 sp->type = SymToken;

Return to:

Send suggestions and report system problems to the System administrator.