From 467c862f2b24e7c023816dbe198275e591f3de29 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Sun, 17 Nov 1996 04:41:53 +0000 Subject: [PATCH] Check for out of memory. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1009 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/otp/otp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/appl/otp/otp.c b/appl/otp/otp.c index 67bd220e4..f0e6c60b1 100644 --- a/appl/otp/otp.c +++ b/appl/otp/otp.c @@ -135,6 +135,10 @@ set (int argc, char **argv, int count, OtpAlgorithm *alg) ctx.alg = alg; ctx.user = strdup (pwd->pw_name); + if (ctx.user == NULL) { + fprintf (stderr, "%s: Out of memory\n", prog); + return 1; + } ctx.n = atoi (argv[0]); strncpy (ctx.seed, argv[1], sizeof(ctx.seed)); ctx.seed[sizeof(ctx.seed) - 1] = '\0';