summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libps/fmt.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libps/fmt.c b/libps/fmt.c
index eae08ffe..3a47338a 100644
--- a/libps/fmt.c
+++ b/libps/fmt.c
@@ -194,7 +194,9 @@ _fmt_create (char *src, int posix, struct ps_fmt_specs *fmt_specs,
while (*src != '\0' && *src != stop)
src++;
}
- *src++ = '\0'; /* NUL terminhate NAME. */
+
+ if (*src)
+ *src++ = '\0'; /* NUL terminate NAME. */
}
else
/* A gnu-style field spec: `NAME' or `NAME:TITLE'. */