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>
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?
<
LuK1337>
but i'd probably use 3 + 2 * sizeof(int)
<
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>
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
<
luca020400>
as later on the wpabuf is memcpy
<
luca020400>
into the buf
<
luca020400>
and it's dynamic shit...