summaryrefslogtreecommitdiff
path: root/lib/shadowmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/shadowmem.c')
-rw-r--r--lib/shadowmem.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/shadowmem.c b/lib/shadowmem.c
index 86d4b0a5..8989598f 100644
--- a/lib/shadowmem.c
+++ b/lib/shadowmem.c
@@ -3,7 +3,7 @@
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
* Copyright (c) 2001 , Michał Moskal
* Copyright (c) 2005 , Tomasz Kłoczko
- * Copyright (c) 2007 - 2009, Nicolas François
+ * Copyright (c) 2007 - 2013, Nicolas François
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,7 +33,7 @@
#include <config.h>
-#ident "$Id: shadowmem.c 3062 2009-09-07 19:08:10Z nekral-guest $"
+#ident "$Id$"
#include "prototypes.h"
#include "defines.h"
@@ -49,6 +49,8 @@
if (NULL == sp) {
return NULL;
}
+ /* The libc might define other fields. They won't be copied. */
+ memset (sp, 0, sizeof *sp);
sp->sp_lstchg = spent->sp_lstchg;
sp->sp_min = spent->sp_min;
sp->sp_max = spent->sp_max;
@@ -56,12 +58,16 @@
sp->sp_inact = spent->sp_inact;
sp->sp_expire = spent->sp_expire;
sp->sp_flag = spent->sp_flag;
+ /*@-mustfreeonly@*/
sp->sp_namp = strdup (spent->sp_namp);
+ /*@=mustfreeonly@*/
if (NULL == sp->sp_namp) {
free(sp);
return NULL;
}
+ /*@-mustfreeonly@*/
sp->sp_pwdp = strdup (spent->sp_pwdp);
+ /*@=mustfreeonly@*/
if (NULL == sp->sp_pwdp) {
free(sp->sp_namp);
free(sp);