Age | Commit message (Collapse) | Author |
|
|
|
but --restrict checking should run on the path up to the last component
before unlinking so tar can't be tricked into deleting random files off
the system.
|
|
Reason: unicolumns() does not print combining characters correctly
Combining characters follow the character which they modify.
https://www.cl.cam.ac.uk/~mgk25/unicode.html#comb
xterm renders cut test1.txt -C -1 now correctly
|
|
Having a dynamic memory pointer named as "s", issuing "free(s)" and then
performing "FLAG(s)" is correct: "FLAG(s)" is a macro which uses "s" as
a token and expands as "FLAG_s". At a glance, this would instead look
like a use-after-free violation.
Fix this readability issue by renaming the "s" pointer variable to
"f_path".
Change-Id: I51f139034a7dcd67a08a6952bc22c1a904162c65
Signed-off-by: Alessio Balsini <balsini@android.com>
|
|
The function loopback_setup() uses xabspath() to get the loopback path.
This function allocates dynamic memory which should be freed by the
function caller.
But there are early return cases where the dynamic memory is not freed.
Besides the special cases of perror_exit(), for which the "early" free
operation is simply used to silence memory analysis tools, the
if (racy && errno == EBUSY) return 1;
branch may be a real cause of memory leak.
Fix by adding a new free() in the racy+EBUSY branch and anticipating the
existing free().
Signed-off-by: Alessio Balsini <balsini@android.com>
|
|
And a few small cleanups while I was there.
|
|
back when they haven't specified -s, add tests.
|
|
And check in more multicast support that's been sitting in the tree, I don't
have a test enviornment for it anymore but somebody wanted this...
|
|
checked relative to the current directory, not from where the symlink lives.
|
|
|
|
(it returns a malloc), and doesn't match the object lifetime of getbasename()
(which always returns some or all of its argument string). The dirname() in
libc modifies its argument string, but that's what posix says to do:
https://pubs.opengroup.org/onlinepubs/9699919799.2008edition/functions/dirname.html
so I guess we can live with it.
|
|
|
|
|
|
add: linelist unload
fix: proper utf8 handling on insert mode backspace
fix: free allocated data at exit
cleanup: rename some variables to be describive but short
cleanup: reorganize some variables in main
|
|
Added: parsing of redirectation responses, will now follow redirectation
path until maximum of 10 jumps. This will probably lead to server
advertising user the https url.
|
|
We need two spaces between filenames because that is the convention
followed by other implementations. More importantly, if we do not have
two spaces, certain Unicode file names cause filenames to run together.
In Unicode, combining characters come before the character they modify.
If a filename ends in a combining character, the combining character
attaches to the space that follows it, causing the space not to be
visible. Having a two-space gap stops the above issue from happening.
For context and a bit more information, see mailing list link below.
https://www.mail-archive.com/toybox@lists.landley.net/msg05986.html
|
|
|
|
|
|
The function loopback_setup(), after copying the loopback device name
with xstrncpy(), ensures the null-termination of the string by forcing
its last byte to 0.
Unfortunately, this operation:
- was probably intended to null-terminate dest instead;
- does not affect the program execution because src is free()d right
after;
- if the size of src is smaller than the offset of the written zero, it
modifies an unknown byte in the heap.
Drop the null-termination line to fix the issue: xstrcpy() automatically
null-terminates dest, or fails if the size of src is bigger than the the
requested number of bytes to copy.
Signed-off-by: Alessio Balsini <balsini@android.com>
|
|
|
|
Inline array becomes garbage outside the if.
|
|
The <netdb.h> functions have their own errno :-(
|
|
Don't run the command with no arguments if we run out of input but
have already run the command at least once. The implementation of "run
the command at least once (unless -r was supplied)" wasn't taking into
account whether or not this was our first time round the loop.
Fix the exit value, and the -- already documented but not implemented --
behavior if a child exits with status 255.
Also extend the tests to cover these cases, plus cases I broke while
coming up with the fix. Add more tests to convince myself that we've
correctly interpreted how -s is supposed to behave, and fix the corner
cases at the bottom end of the range.
This fixes some issues we were seeing trying to build the Android SDK
for (and more importantly, on) macOS.
|
|
When user builds toybox CFG_TOYBOX_I18N disabled and tries to list
folder contents with multibyte characters other than UTF-8 ls might
seqfault since wcrtomb returns -1
while locale set to fi_FI-UTF-8 disable CFG_TOYBOX_I18N
touch őőőőaaőő
ls
|
|
fix: force redraw after :set (no)list
fix: force redraw after insert
fix: split on zero cursor position
fix: yank and push with utf-8 content
|
|
and cleanup hostname to only call gethostname() once.
It passes the one test in test_hostname, if that helps.
|
|
|
|
Scroll visual buffer up and down using standard escapes when content
has not changed, instead of redrawing every keypress.
Sidescroll now moves all the lines instead of only cursor one.
Side scrolling long lines unfortunately causes redraw to whole screen.
-Jarno
|
|
We're inconsistent about whether the option help below should be just `-t`
or `-t DIR`, but the majority of commands _don't_ repeat their argument,
so I've left that as-is for now.
|
|
I must have lost this line somehow when I moved the patch from my AOSP
tree to a toybox tree. (But the ln tests passed on the host because I
was using coreutils ln there :-( )
|
|
|
|
|
|
|
|
Required by the new `ln -t` test if it's to pass on an all-toybox
system :-)
|
|
|
|
|
|
|
|
Thanks for James McMechan for pointing this out.
Using esc[1L and esc[1M escapes with cursor jump to
1, 1 to make scrolling effect instead of S and T
fixes scrolling inside Linux terminal and tmux
-Jarno
|
|
|
|
|
|
Add mock gzip -n to satisfy pkgsrc.
|
|
Branch wget to xexec ftpget given an ftp url. Rename the output flag -O
like in other wgets. Add mock wget --no-check-certificate to satisfy
pkgsrc. Ifdef the version output in wget because the nonexistent
constant fails single builds and mkroot.
|
|
Investigate why downloads always freeze when I call ftpget. Trace it to
a refactor leaving two REST and zero RETR.
|
|
Added: yank and push
Rewrote: delete operations
Minor cleanups:
Rewrote delete operations to use one delete function instead of having
separate behavior here and there.
Now delete and yank both always move cursor and then clip the whole
cursor area into yank register. For example x is just ld or jd depeding
are we right edge or not, and dd is jd with some special flags etc.
Now only default yank register is implemented, but implemeting
yank register list should be trivial since cmd execution already passes
register char.
|
|
|
|
Replaced: draw_str_until with lib/crunch_str() where possible
Removed: Unused char draw functions.
Implemented: crunch_nstr() which is crunch_str with additional check
for byte length, this can be used to draw substrings or non null
terminated strings. (This can be moved to lib/ if its useful for others)
Reimplemented: Buffer drawing without line wrapping. Now too long lines are
drawn with @ in end. And cursor line scrolls left and right when hitting
right margin point. This will simplify buffer handling alot.
Linewrapping can be reimplemented later if needed but will add
complexity
Implemented: set list and set nolist ex commands, set list will show
escape codes such as tabs
Fix: Bug on splitting 2 lines, split was 1 byte off.
|
|
|
|
xwaitpid(), fix off by one in xwaitpid().
|
|
The "gratuitous extra entry" is only gratuitous when there isn't a hole. (Which
we can detect and not include but then we wouldn't match other implementations.)
|
|
|