From 2b6cf6296c43392a3343b73ede14158fd19a1012 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Fri, 24 Apr 2020 17:28:19 +0200 Subject: [PATCH] Fix bug where config file values with a colon were interpreted as entries (2) --- qloader2.bin | Bin 32768 -> 32768 bytes src/lib/config.c | 6 ++++++ 2 files changed, 6 insertions(+) diff --git a/qloader2.bin b/qloader2.bin index 0dc85c126c5ce4d6951b5b36a6a4ecc05941edcb..8eb8a38059d82c743989a683fd072331d6706900 100644 GIT binary patch delta 5351 zcmZuV30PBSw)ckw0tONUEUN^s>UmhGukGWejQ6N@Jh^! zt)9MlZKYEv?Tk7)qaSKrS|=_L>Abeu)){@)8MW297|Xb{j-vI>IXB|?IlbR^|9kdx z{&UX1BzAj%-5#(@CSyB5E?ZK+^v@h;Q%+7?gkMz)4xFR7V*o$4XvZ}r&uKVL2v6X+ zE+RUPt2^oIJbGkMW^qQFP~LGtW$BuSfb)#=rt1BpvLhE{UDbp~*FldgsX~u%rCWDG zuWyJH){K&@+}537)>4=5Th+ef=tj)1Lm@Gr)I^&?@6@&PQHRmmihBHhM_;}i zYJ-y4Vt5(HU%(a|op1=p4mcOIE+8}=YJzKr9YW_mg`rZO!FwBr;= zxFRGjj@b0{`9Ac@Nrxfg`yIm298wywMJuJrweEf&X?N~|Ga=(AlTuA>eSahxLaNE= zJmM(cL6%f4Tp-7}OHLMryqMyOwxYq60imkHeeRixlg@xn9(18&nil<$KH&iEBk5;NQUaA;If>BYQ&EtZQ6f;Jj$$$z zLnH}6lEEP66D;PFQ2+S{qUcYRd-^5Eo!}SM9gS$#ap8Kv`t?{=UxIu38KN)Tu)Yy- zT!h$aBymX<$4cGwz{s%CDzZv={}vpulg(kHo2YyTIuOU=-Ox91LLG*H zyNj>N-(0PI)-s{!9@6>)oKm~_#tGSoOY5qwjl*?S{Emv_)@ zCP>8ASy*PhFc6QKJg#o_Si@*n+zo$K{V)41tW|%&UWSASEBg~{ide}s-9JWzGgi>8 zj2y!PLbIVL>JY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+6@&M~d`|lVu=8L9(CE*WIfllM?QqxunR=|8RleiN$Ptc_)&f#5gwtn!z zv-djPoey!7`{YCT{n!}xE!>z;8qi8M3!or3Hu@a|U2SVIFLW6Z6LI_Y4sX;7@4$-O zQAM33*om2V6wGq6NMj%^70S` zi7G+uL6Q|o({Vg~Z{o+1n0*B^QikL3D9ay>)mfr;>t#yvBT9qCS+c?6E=ClK+&u&P zyCpVeO{GDXA|?o+ofCQ10{2 zEzkQgriZP08Te&!EHA5t+z&o*rkbU2*ODLP%UUHrbcsfuy^Gn;a_)r)I^>Hu9&!jC zxn5IyYP-?m964_9Qj6qQx8oFvXolgn9dF3?Z*SQ9H`n)`0|+a-4=+lcS%b z7&NT@RxaEcE9mm4xaa2whiSVxE*9Tpd~@-g()o*$`%3m9ESo)!Wx=-DQc!KnEWI6?4Mb8dx-E9BYBi*d{^uoFrBRSLaMsmVY8i zJ+f5c+;Dak409*3KZ9fLRCW$d%uU1g=G-*przrJDSt^?kSDOAJN$<*7Js*x2-IaU> z)4>jGm%|A@p4CDhpTu5(5JQG?@Bc{B1lU{|4!j|P9fl=_B=!S14CC-m-+n_ZdlSwX z;;}66ApL8IuAIqk!=lOz#LIRJMnFVXTwQs=fEAL%z^0YG*$=Gs^i%rScLFWa8ysiZ^`cJnL!Ki>Z)Pr z7Q!&C#gJ>tVAZh5RL4%iA=6A22}<)!_9v(?C*k+~N^>~2ZRQO2F??i>XJ_DyIY}|| de{p7qcdBdVD?)~TT9C>1&Zb&t3hZRs{|6p<*+T#T diff --git a/src/lib/config.c b/src/lib/config.c index 987afce6..92626869 100644 --- a/src/lib/config.c +++ b/src/lib/config.c @@ -40,6 +40,8 @@ int config_get_entry_name(char *ret, size_t index, size_t limit) { p++; } p++; + if (*(p - 2) != '\n') + i--; } size_t i; @@ -69,9 +71,13 @@ int config_set_entry(size_t index) { config_addr = p; +cont: while (*p != ':' && *p) p++; + if (*p && *(p - 1) != '\n') + goto cont; + *p = 0; return 0;