BR3392274: output: Elf -- Don't crash on erronious syntax
authorCyrill Gorcunov <gorcunov@gmail.com>
Sat, 15 Feb 2014 14:40:12 +0000 (18:40 +0400)
committerCyrill Gorcunov <gorcunov@gmail.com>
Sat, 15 Feb 2014 14:40:12 +0000 (18:40 +0400)
Elf align section attribute requires syntax "align=value",
but in case if '=' is missed we pass nil pointer into
atoi function which cause libc to crash.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
output/outelf.c

index 9ec0035..bfbf625 100644 (file)
@@ -76,7 +76,7 @@ void section_attrib(char *name, char *attr, int pass,
         return;
 
     while ((opt = nasm_opt_val(opt, &val, &next))) {
-        if (!nasm_stricmp(opt, "align")) {
+        if (!nasm_stricmp(opt, "align") && val) {
             *align = atoi(val);
             if (*align == 0) {
                 *align = SHA_ANY;