mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 16:37:19 +09:00
Merge pull request #18863 from keszybz/cmdline-escaping
Escape command lines properly
This commit is contained in:
@@ -129,6 +129,9 @@ static inline bool _pure_ in_charset(const char *s, const char* charset) {
|
||||
return s[strspn(s, charset)] == '\0';
|
||||
}
|
||||
|
||||
static inline bool char_is_cc(char p) {
|
||||
return (p >= 0 && p < ' ') || p == 127;
|
||||
}
|
||||
bool string_has_cc(const char *p, const char *ok) _pure_;
|
||||
|
||||
char *ellipsize_mem(const char *s, size_t old_length_bytes, size_t new_length_columns, unsigned percent);
|
||||
@@ -216,17 +219,13 @@ static inline void *memory_startswith_no_case(const void *p, size_t sz, const ch
|
||||
return (uint8_t*) p + n;
|
||||
}
|
||||
|
||||
static inline char* str_realloc(char **p) {
|
||||
/* Reallocate *p to actual size */
|
||||
static inline char* str_realloc(char *p) {
|
||||
/* Reallocate *p to actual size. Ignore failure, and return the original string on error. */
|
||||
|
||||
if (!*p)
|
||||
if (!p)
|
||||
return NULL;
|
||||
|
||||
char *t = realloc(*p, strlen(*p) + 1);
|
||||
if (!t)
|
||||
return NULL;
|
||||
|
||||
return (*p = t);
|
||||
return realloc(p, strlen(p) + 1) ?: p;
|
||||
}
|
||||
|
||||
char* string_erase(char *x);
|
||||
|
||||
Reference in New Issue
Block a user