From: Alan T. DeKok Date: Sun, 17 Feb 2013 20:19:03 +0000 (-0500) Subject: Check for NULL before incrementing X-Git-Tag: release_3_0_0_beta1~1065 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e731205fd21eb8534d17fe10b7b1c45e414445a0;p=thirdparty%2Ffreeradius-server.git Check for NULL before incrementing --- diff --git a/scripts/jlibtool.c b/scripts/jlibtool.c index 6ffaf4b7c4a..a34a5d5ba4a 100644 --- a/scripts/jlibtool.c +++ b/scripts/jlibtool.c @@ -969,7 +969,14 @@ static char *gen_library_name(const char *name, enum lib_type genlib) strcpy(newarg, name); } - newext = strrchr(newarg, '.') + 1; + newext = strrchr(newarg, '.'); + if (!newext) { + printf("Error: Library path does not have an extension"); + free(newarg); + + return NULL; + } + newext++; switch (genlib) { case type_STATIC_LIB: @@ -1076,13 +1083,14 @@ static char *check_library_exists(command_t *cmd, const char *arg, int pathlen, } strcpy(newarg + newpathlen, arg + pathlen); - ext = strrchr(newarg, '.') + 1; + ext = strrchr(newarg, '.'); if (!ext) { printf("Error: Library path does not have an extension"); free(newarg); return NULL; } + ext++; pass = 0;