diff options
Diffstat (limited to 'gshadow')
-rw-r--r-- | gshadow/sgetsgent_r.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gshadow/sgetsgent_r.c b/gshadow/sgetsgent_r.c index 72c51fe..2292719 100644 --- a/gshadow/sgetsgent_r.c +++ b/gshadow/sgetsgent_r.c @@ -58,7 +58,12 @@ __sgetsgent_r (const char *string, struct sgrp *resbuf, char *buffer, { char *sp; if (string < buffer || string >= buffer + buflen) - sp = strncpy (buffer, string, buflen); + { + buffer[buflen - 1] = '\0'; + sp = strncpy (buffer, string, buflen); + if (buffer[buflen - 1] != '\0') + return ERANGE; + } else sp = (char *) string; |