diff options
author | pgen <p.gen.progs@gmail.com> | 2022-05-19 17:53:25 +0200 |
---|---|---|
committer | pgen <p.gen.progs@gmail.com> | 2022-05-19 18:15:18 +0200 |
commit | 1a418383be493222ae261d28d92c5bb465571271 (patch) | |
tree | 2fccb2a22305330c320fd04294174d16728c8155 | |
parent | 90e0add8ef7d92660c321b8b1538fccbf522b689 (diff) |
Fix the parsing of attributes
- A variable used in a test is not initialized.
- Add space to parse all the attributes
-rw-r--r-- | smenu.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -357,15 +357,15 @@ parse_attr(char * str, attrib_t * attr, short max_color) int n; char * pos; char s1[12] = { (char)0 }; - char s2[7] = { (char)0 }; + char s2[9] = { (char)0 }; short d1 = -1, d2 = -1; int rc = 1; - char c; + char c = '\0'; /* 11: 4 type+colon,2x3 for colors, 1 for slash. */ - /* 6 : max size for the concatenation of attributes. */ + /* 8 : max size for the concatenation of attributes. */ /* """"""""""""""""""""""""""""""""""""""""""""""""" */ - n = sscanf(str, "%11[^,],%6s%c", s1, s2, &c); + n = sscanf(str, "%11[^,],%8s%c", s1, s2, &c); if (n == 0 || c != '\0') return 0; |