diff options
author | Denis Vlasenko | 2009-03-18 17:32:44 +0000 |
---|---|---|
committer | Denis Vlasenko | 2009-03-18 17:32:44 +0000 |
commit | 9f57cf6604638f14390effa01b51c8ad979f14cd (patch) | |
tree | 713ecefd47867bb5d2b16c4ae3e5acd28c1c90e3 /include | |
parent | fce4a9454c5399c2ce8ca8e87048331c6e3d98fa (diff) | |
download | busybox-9f57cf6604638f14390effa01b51c8ad979f14cd.zip busybox-9f57cf6604638f14390effa01b51c8ad979f14cd.tar.gz |
ftpd: fix command fetching to not do it in 1-byte reads;
fix command de-escaping. Tested to download files with embeeded \xff and LF.
libbb: tweaks for the above
function old new delta
ftpd_main 2231 2321 +90
xmalloc_fgets_internal 190 222 +32
xmalloc_fgets_str_len - 27 +27
xmalloc_fgets_str 7 23 +16
xmalloc_fgetline_str 10 26 +16
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/0 up/down: 181/0) Total: 181 bytes
Diffstat (limited to 'include')
-rw-r--r-- | include/libbb.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/libbb.h b/include/libbb.h index bc47ce7..8ea493b 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -594,9 +594,9 @@ extern ssize_t open_read_close(const char *filename, void *buf, size_t maxsz) FA // Reads byte-by-byte. Useful when it is important to not read ahead. // Bytes are appended to pfx (which must be malloced, or NULL). extern char *xmalloc_reads(int fd, char *pfx, size_t *maxsz_p) FAST_FUNC; -/* Reads block up to *maxsz_p (default: MAX_INT(ssize_t)) */ +/* Reads block up to *maxsz_p (default: INT_MAX - 4095) */ extern void *xmalloc_read(int fd, size_t *maxsz_p) FAST_FUNC; -/* Returns NULL if file can't be opened */ +/* Returns NULL if file can't be opened (default max size: INT_MAX - 4095) */ extern void *xmalloc_open_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC; /* Autodetects .gz etc */ extern int open_zipped(const char *fname) FAST_FUNC; @@ -619,6 +619,8 @@ extern char *bb_get_chunk_from_file(FILE *file, int *end) FAST_FUNC; extern char *bb_get_chunk_with_continuation(FILE *file, int *end, int *lineno) FAST_FUNC; /* Reads up to (and including) TERMINATING_STRING: */ extern char *xmalloc_fgets_str(FILE *file, const char *terminating_string) FAST_FUNC; +/* Same, with limited max size, and returns the length (excluding NUL): */ +extern char *xmalloc_fgets_str_len(FILE *file, const char *terminating_string, size_t *maxsz_p) FAST_FUNC; /* Chops off TERMINATING_STRING from the end: */ extern char *xmalloc_fgetline_str(FILE *file, const char *terminating_string) FAST_FUNC; /* Reads up to (and including) "\n" or NUL byte: */ |