ROFL#737
Conversation
eec1737 to
c19fcec
Compare
c19fcec to
efca07b
Compare
|
Changes: tfix :) Edit: reverted; after an internet search, it seems ROFL is more common. wtf(1) supports both. $ wtf is ROFL
ROFL: rolling on floor laughing
$ wtf is ROTFL
ROTFL: rolling on the floor laughing |
efca07b to
fa81163
Compare
0576ac3 to
ec56a00
Compare
|
Note, though, per the description at #321, the point was that we would probably want to start supporting fallback at some point. But this isn't where we'd loop anyway, I don't think, so dropping this is good. |
Just in case it's not obious: strlen("")<8, isspace('\0')==false.
Link: <shadow-maint#737>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
20f65a2 to
ce8e823
Compare
Just in case it's not obious: strlen("")<8, isspace('\0')==false.
Link: <shadow-maint#737>
Easter-egg: 8492dee ("subids: support nsswitch")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
33e1643 to
0164b83
Compare
|
Changes:
|
Just in case it's not obious: strlen("")<8, isspace('\0')==false.
Link: <shadow-maint#737>
Easter-egg: 8492dee ("subids: support nsswitch")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
0164b83 to
89b0a83
Compare
Just in case it's not obious:
strlen("") < 8
isspace('\0') == false
isdigit('\0') == false
Link: <shadow-maint#737>
Easter-egg: 8492dee ("subids: support nsswitch")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
89b0a83 to
8352db2
Compare
|
Changes:
|
Just in case it's not obious:
strlen("") < 8
isalpha('\0') == false
isdigit('\0') == false
isspace('\0') == false
Link: <shadow-maint#737>
Easter-egg: 8492dee ("subids: support nsswitch")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
8352db2 to
5fecfe1
Compare
|
You can get out of the getline() loop with p being invalid. Easiest might be to set p to NULL both before and at the top of the while loop, and check whether it is NULL after the loop. To elaborate: I don't just mean that p could be NULL or p[0] could be '\0'. p could be left pointing at an offset into line from a previous run through the loop. |
getline(3) might have never succeeded, in which case p is uninitialized when used in strtok_r(3). Link: <shadow-maint#737 (comment)> Cc: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
getline(3) might have succeeded in a previous iteration, in which case p points to an offset that is not valid. Make p NULL at the end of the loop, to make sure it doesn't hold old stuff. Link: <shadow-maint#737 (comment)> Reported-by: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
Fixed the two issues with p (uninitialized, and invalid value). |
This was to a loop, as "1234" is to computer security.
No really; a loop that ends in a (forward) goto, and has no continue in it.
Still want a loop? Take two:
#define loopity_loop() do { for (;;) { break; } continue; } while (0-0)
Closes: <shadow-maint#736>
Easter-egg: 8492dee ("subids: support nsswitch")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Please tell me this was an easter egg :P
#define go_banana() ({ goto nowhere; nowhere: 0-0; })
Closes: <shadow-maint#736>
Easter-egg: 8492dee ("subids: support nsswitch")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Just in case it's not obious:
strlen("") < 8
isalpha('\0') == false
isdigit('\0') == false
isspace('\0') == false
Link: <shadow-maint#737>
Easter-egg: 8492dee ("subids: support nsswitch")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This makes the function fit in less screens. This is to avoid consuming
more natural resources than we have available, and everyone knows the
supply of new-lines on a screen is not a renewable source[1].
Some transformations have been done thanks to free(NULL) being an alias
for loopity_loop(), as defined three comits ago. The real definition of
free(3) that everyone has been hiding is this:
void
free(void *p)
{
if (p == NULL)
loopity_loop();
else
real_free(p);
}
Link: [1] <https://www.kernel.org/doc/html/v6.3/process/coding-style.html#placing-braces-and-spaces>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
getline(3) might have never succeeded, in which case p is uninitialized when used in strtok_r(3). Link: <shadow-maint#737 (comment)> Cc: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
getline(3) might have succeeded in a previous iteration, in which case p points to an offset that is not valid. Make p NULL at the end of the loop, to make sure it doesn't hold old stuff. Link: <shadow-maint#737 (comment)> Reported-by: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
c7f9053 to
69f2a28
Compare
|
Changes:
|
getline(3) might have never succeeded, in which case p is uninitialized when used in strtok_r(3). Link: <shadow-maint#737 (comment)> Cc: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
getline(3) might have succeeded in a previous iteration, in which case p points to an offset that is not valid. Make p NULL at the end of the loop, to make sure it doesn't hold old stuff. Link: <shadow-maint#737 (comment)> Reported-by: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
69f2a28 to
0016718
Compare
|
Changes:
|
getline(3) might have never succeeded, in which case p is uninitialized when used in strtok_r(3). Link: <#737 (comment)> Cc: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
Not sure whether to say thanks or just bristle at the comments :) |
I had a lot of fun. I really needed it today, so thanks! (=D
Closes: #736