LuK1337 changed the topic of #titandev to: Loliés! | *yiff* | https://libera.irclog.whitequark.org/titandev
hanetzer has quit [Ping timeout: 265 seconds]
hanetzer has joined #titandev
hanetzer has joined #titandev
hanetzer has quit [Changing host]
<luca020400> am stupid or the malloc is never big enough?
<luca020400> ( before the 5 change )
<luca020400> buf = _cmd + cmd + iftype + src
<luca020400> len = len(_cmd) + len(src) + 3
<LuK1337> not sure what's supposed to be there...
<LuK1337> src?
<LuK1337> i thought it's _cmd, cmd, iftype and null
<luca020400> "%s %d %d" + \0, _cmd, cmd, iftype
<luca020400> so " %d %d\0" = 5
<luca020400> where the heck is 3 coming from
<luca020400> also only works if int are < 10
<LuK1337> i kinda know where 3 is from
<LuK1337> 2 spaces + null
<luca020400> they forgot to add ints?
<luca020400> xD
<LuK1337> maybe?
<LuK1337> but i'd probably use 3 + 2 * sizeof(int)
<luca020400> yeah
<luca020400> current hardcoding is stupid
<LuK1337> but if ints are always between 0 and 9
<LuK1337> then 5 should be ok
<luca020400> that's why I said "works only if <10"
<luca020400> gotta check
<LuK1337> tbf i'd probably use asprintf...
<luca020400> this whole code is a mess
<LuK1337> it /should/ be available in bionic
<luca020400> the null check can very likely lead to mem leaks
<LuK1337> hm?
<LuK1337> null check is before alloc
<LuK1337> and os_zalloc shouldn't allocate anything if it returns null
<luca020400> if the last wpabuf is null it will
<luca020400> assocresp
<luca020400> ah nvm
<luca020400> the if style made me read it incrorrectly
<LuK1337> tho really if they don't have to give shit about upstream
<LuK1337> just use asprintf
<luca020400> asprintf doesn't really work
<LuK1337> hm?
<luca020400> as later on the wpabuf is memcpy
<luca020400> into the buf
<LuK1337> eh
<luca020400> and it's dynamic shit...