diff --git a/SOURCES/at-3.1.10-filter-environment.patch b/SOURCES/at-3.1.10-filter-environment.patch
new file mode 100644
index 0000000..55fc669
--- /dev/null
+++ b/SOURCES/at-3.1.10-filter-environment.patch
@@ -0,0 +1,26 @@
+diff -up at-3.1.10/at.c.filter-environment at-3.1.10/at.c
+--- at-3.1.10/at.c.filter-environment	2014-10-02 10:21:01.684890331 +0200
++++ at-3.1.10/at.c	2014-10-02 10:21:40.678770635 +0200
+@@ -388,6 +388,22 @@ writefile(time_t runtimer, char queue)
+ 	int export = 1;
+ 	char *eqp;
+ 
++        /* Only accept alphanumerics and underscore in variable names.
++         * Also require the name to not start with a digit.
++         * Some shells don't like other variable names.
++         */
++        {
++            char *p = *atenv;
++            if (isdigit(*p))
++                export = 0;
++            for (; *p != '=' && *p != '\0'; ++p) {
++                if (!isalnum(*p) && *p != '_') {
++                    export = 0;
++                    break;
++                }
++            }
++        }
++
+ 	eqp = strchr(*atenv, '=');
+ 	if (ap == NULL)
+ 	    eqp = *atenv;
diff --git a/SPECS/at.spec b/SPECS/at.spec
index 8071ab3..95245bf 100644
--- a/SPECS/at.spec
+++ b/SPECS/at.spec
@@ -3,7 +3,7 @@
 Summary:	Job spooling tools
 Name:		at
 Version:	3.1.13
-Release:	17%{?dist}
+Release:	17%{?dist}.1
 # http://packages.debian.org/changelogs/pool/main/a/at/current/copyright
 # + install-sh is MIT license with changes under Public Domain
 License:	GPLv3+ and GPLv2+ and ISC and MIT and Public Domain
@@ -28,6 +28,7 @@ Patch8:		at-3.1.12-fix_no_export.patch
 Patch9:         at-3.1.13-mailwithhostname.patch
 Patch10:        at-3.1.13-usePOSIXtimers.patch
 Patch11:        at-3.1.13-help.patch
+Patch12:        at-3.1.10-filter-environment.patch
 
 BuildRequires: fileutils /etc/init.d
 BuildRequires: flex flex-static bison autoconf
@@ -81,6 +82,7 @@ cp %{SOURCE1} .
 %patch9 -p1 -b .mail
 %patch10 -p1 -b .posix
 %patch11 -p1 -b .help
+%patch12 -p1 -b .filter-environment
 
 %build
 # patch9 touches configure.in
@@ -187,6 +189,9 @@ chown daemon:daemon %{_localstatedir}/spool/at/.SEQ
 %attr(0755,root,root)		%{_initrddir}/atd
 
 %changelog
+* Mon Oct  6 2014 Tomáš Mráz <tmraz@redhat.com> - 3.1.13-17.1
+- filter environment variables not acceptable in bash input
+
 * Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 3.1.13-17
 - Mass rebuild 2014-01-24