summaryrefslogtreecommitdiffstats
path: root/lib/mangle.c
Commit message (Collapse)AuthorAgeFilesLines
* lib/mangle: fix possible null pointer dereference [cppcheck]Sami Kerola2019-05-181-2/+2
| | | | | | Fix effects code that is used when testing util-linux, so quite low impact. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libmount: don't use sscanf() for fstab parsingKarel Zak2019-04-081-1/+1
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/780 Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/mangle: const quialifier cleanupKarel Zak2018-07-201-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/mangle: return size of the decoded bufferKarel Zak2017-11-011-2/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: use unique ifdefs for testsKarel Zak2017-01-041-2/+2
| | | | | | | Let's use unique TEST_PROGRAM_<NAME> ifdefs to make build system more robust. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/mangle: remove unused variableKarel Zak2012-08-131-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix unmangle codeKarel Zak2012-08-131-2/+3
| | | | | | | | | | | old version: /mnt/ugly/te\134st\134 -> /mnt/ugly/te\st\134 fixed version: /mnt/ugly/te\134st\134 -> /mnt/ugly/te\st\ Reported-by: Naja Melan <najamelan@autistici.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/mangle: fix a memory leak in the test caseCong Wang2012-06-211-2/+6
| | | | | | | | | | | | | Marek reported there is a memory leak in lib/mangle.c CC mangle.o mangle.c:160:9: warning: Memory is never released; potential leak of memory pointed to by 'ss' This patch fixes it. Reported-by: Marek Otahal <markotahal@gmail.com> Cc: Karel Zak <kzak@redhat.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
* lib/mangle: check for end of string on every iterationDave Reisner2012-05-151-4/+5
| | | | | | | | | Checking for the null byte at the end of the string only conditionally leads to segfaults, evidenced by mount helpers crashing on writes to /run/mount/utab. Simply check for the null on each iteration, and append a null byte to the mangled string before breaking. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* lib/mangle: cleanup, add unhexmangleKarel Zak2012-04-261-18/+39
| | | | | | | | * use strchr() rather than for() * small refactoring in mangle code * add un-hex-mangle Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [mangle.c] fix compiler warnings [-Wsign-compare]Karel Zak2011-08-011-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: segfaults with inconsistent entry in /etc/fstabKarel Zak2011-03-041-0/+2
| | | | | | Addresses: https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/726283 Reported-by: Greg Brockman <gdb@gregbrockman.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: provide alternatives for err, errx, warn and warnxFabian Groffen2011-02-141-1/+1
| | | | | | | | Solaris lacks err, errx, warn and warnx. This also means the err.h header doesn't exist. Removed err.h include from all files, and included err.h from c.h instead if it exists, otherwise alternatives are provided. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libmount: cleanup mangle() usageKarel Zak2011-01-031-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: use better format for utab, improve bind mountsKarel Zak2011-01-031-5/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: rewrite mountinfo/fstab parsers to use sscanf()Karel Zak2011-01-031-3/+12
| | | | | | | | The old solution (without scanf()) was based on old code from mount(8). It seems that the modern libc is able to provide all necessary functionality by sscanf() and %ms directive. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: fix mange() and unmangle() to handle NULLKarel Zak2011-01-031-0/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add unmangle/mangle() functions to APIKarel Zak2011-01-031-4/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: add mangle.c for mtab (fstab or swaps) encodingKarel Zak2010-03-101-0/+116
Signed-off-by: Karel Zak <kzak@redhat.com>